From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Jakub Kicinski'" <kuba@kernel.org>
Cc: <netdev@vger.kernel.org>, <mengyuanlou@net-swift.com>,
<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <pabeni@redhat.com>,
<larysa.zaremba@intel.com>, <netdev@vger.kernel.org>,
<mengyuanlou@net-swift.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <pabeni@redhat.com>,
<larysa.zaremba@intel.com>
Subject: RE: [PATCH net] net: txgbe: fix interrupt mask for MISC cause in non-MSI-X mode
Date: Tue, 18 Aug 2026 09:46:33 +0800 [thread overview]
Message-ID: <00df01dd2eb3$65ef53f0$31cdfbd0$@trustnetic.com> (raw)
In-Reply-To: <20260817205809.3620094-1-kuba@kernel.org>
On Tue, Aug 18, 2026 4:58 AM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: txgbe: fix interrupt mask for MISC cause in non-MSI-X mode
>
> The patch changes the trailing unmask in txgbe_misc_irq_thread_fn() so that
> it uses BIT(0) instead of TXGBE_INTR_MISC(wx) when MSI-X is not enabled,
> because the hardware merges all interrupt causes into BIT(0) in MSI/INTx
> mode. This is meant to avoid delaying subsequent MISC interrupts until NAPI
> polling completes.
>
> > diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c
> > index 8746318ad3bcb..05b318f4e6ed6 100644
> > --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c
> > +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_irq.c
>
> [ ... ]
>
> > @@ -183,7 +184,8 @@ static irqreturn_t txgbe_misc_irq_thread_fn(int irq, void *data)
> > nhandled++;
> > }
> >
> > - wx_intr_enable(wx, TXGBE_INTR_MISC(wx));
> > + misc_mask = wx->pdev->msix_enabled ? TXGBE_INTR_MISC(wx) : BIT(0);
> > + wx_intr_enable(wx, misc_mask);
> > return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
> > }
>
> [Severity: Medium]
> Should this unmask be guarded by WX_STATE_DOWN now that it touches the live
> BIT(0) cause?
>
> In non-MSI-X mode this write becomes a real WX_PX_IMC(0) = BIT(0), which
> re-arms the single merged queue+MISC cause. Before the change the value was
> BIT(wx->num_q_vectors) = BIT(1) with num_q_vectors == 1 in this mode, i.e. a
> bit the hardware does not use here, so the write left no hardware residue.
>
> wx_irq_disable() in libwx/wx_hw.c masks everything before it waits for
> in-flight handlers:
>
> void wx_irq_disable(struct wx *wx)
> {
> struct pci_dev *pdev = wx->pdev;
>
> wr32(wx, WX_PX_MISC_IEN, 0);
> wx_intr_disable(wx, WX_INTR_ALL);
>
> if (pdev->msix_enabled) {
> ...
> } else {
> synchronize_irq(pdev->irq);
> }
> }
>
> Can a misc thread that is already running execute its trailing
> wx_intr_enable(wx, BIT(0)) after those mask writes, so that synchronize_irq()
> returns with the only active cause unmasked while the driver considers
> interrupts off?
>
> The window in txgbe_disable_device() spans wx_irq_disable() through
> wx_napi_disable_all(), timer_delete_sync(), cancel_work_sync() and the TX ring
> shutdown, and the mask is only restored later via txgbe_reset() ->
> txgbe_reset_hw() -> wx_stop_adapter(). Since the TX rings and TX DMA engine
> are stopped after wx_irq_disable(), a TX completion cause could assert on the
> re-unmasked BIT(0) during that window; on a shared INTx line the hard handler
> then takes the eicr == 0 path, returns IRQ_NONE and does not write
> WX_PX_INTA.
>
> Every other unmask site in this driver family wraps the same operation in the
> down check, for example wx_poll() in libwx/wx_lib.c:
>
> if (!test_bit(WX_STATE_DOWN, wx->state))
> wx_intr_enable(wx, WX_INTR_Q(q_vector->v_idx));
>
> and ngbe_intr() in ngbe/ngbe_main.c:
>
> if (!test_bit(WX_STATE_DOWN, wx->state))
> ngbe_irq_enable(wx, false);
>
> txgbe_misc_irq_handle() itself uses the guard on its shared interrupt path.
> Would something like the following be more consistent?
>
> misc_mask = wx->pdev->msix_enabled ? TXGBE_INTR_MISC(wx) : BIT(0);
> if (!test_bit(WX_STATE_DOWN, wx->state))
> wx_intr_enable(wx, misc_mask);
Right, I'll fix it in V2.
prev parent reply other threads:[~2026-08-18 1:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 7:33 [PATCH net] net: txgbe: fix interrupt mask for MISC cause in non-MSI-X mode Jiawen Wu
2026-08-14 17:13 ` Simon Horman
2026-08-17 20:58 ` Jakub Kicinski
2026-08-18 1:46 ` Jiawen Wu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00df01dd2eb3$65ef53f0$31cdfbd0$@trustnetic.com' \
--to=jiawenwu@trustnetic.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.