From: "Nikhil P. Rao" <nikhil.rao@amd.com>
To: Brett Creeley <brett.creeley@amd.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Eric Joyner <eric.joyner@amd.com>,
Abhijit Gangurde <abhijit.gangurde@amd.com>,
"Allen Hubbe" <allen.hubbe@amd.com>,
"Nikhil P. Rao" <nikhil.rao@amd.com>
Subject: [PATCH net v2 5/5] ionic: fix DIM work racing the queue teardown
Date: Fri, 4 Dec 2026 22:04:24 +0000 [thread overview]
Message-ID: <20261204-b4-pr60-v2-5-9e0b5408a68e@amd.com> (raw)
In-Reply-To: <20261204-b4-pr60-v2-0-9e0b5408a68e@amd.com>
ionic_qcq_disable() cancels a queue's DIM work before it masks the
interrupt and disables NAPI, so a poll that runs in between can queue
the work again. The queue is freed when the interface goes down or a
reset tears it down, and a PCI reset also unmaps BAR0, so the requeued
work then writes the interrupt control register through the freed
queue and can write the unmapped BAR.
Cancel the work once NAPI is disabled, when no poll can queue it again.
A work item the cancel drops is what would have returned DIM to
measuring, so reset its state there too; otherwise DIM stays stuck when
the queues restart on the same qcq after a link flap or reconfiguration.
Found by an AI code review of the previous version of this series and
confirmed by reading the code. Not reproduced, as nothing can hold a
NAPI poll between the cancel and napi_disable(). Tested on an AMD
Pensando NIC, on a kernel with KASAN and lockdep, with the PCI reset
tests.
Fixes: 04a834592bf5 ("ionic: dynamic interrupt moderation")
Reported-by: Sashiko AI review <netdev-bot+sashiko@kernel.org>
Closes: https://lore.kernel.org/netdev/179625854521.3146.11030796304497825514@kernel.org/
Signed-off-by: Nikhil P. Rao <nikhil.rao@amd.com>
---
drivers/net/ethernet/pensando/ionic/ionic_lif.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 339a3c4c5b43..909781f06496 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -358,13 +358,14 @@ static int ionic_qcq_disable(struct ionic_lif *lif, struct ionic_qcq *qcq, int f
if (lif->doorbell_wa)
cancel_work_sync(&qcq->doorbell_napi_work);
- cancel_work_sync(&qcq->dim.work);
ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
IONIC_INTR_MASK_SET);
synchronize_irq(qcq->intr.vector);
irq_set_affinity_notifier(qcq->intr.vector, NULL);
irq_set_affinity_hint(qcq->intr.vector, NULL);
napi_disable(&qcq->napi);
+ cancel_work_sync(&qcq->dim.work);
+ qcq->dim.state = DIM_START_MEASURE;
}
/* If there was a previous fw communcation error, don't bother with
--
2.43.0
prev parent reply other threads:[~2026-12-04 22:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 22:04 [PATCH net v2 0/5] ionic: fix register reads racing the BAR unmap on PCI reset Nikhil P. Rao
2026-12-04 22:04 ` [PATCH net v2 1/5] ionic: fix devcmds " Nikhil P. Rao
2026-12-04 22:04 ` [PATCH net v2 2/5] ionic: fix device info register reads " Nikhil P. Rao
2026-12-04 22:04 ` [PATCH net v2 3/5] ionic: fix PHC " Nikhil P. Rao
2026-12-04 22:04 ` [PATCH net v2 4/5] ionic: fix ethtool coalesce updates racing a reset Nikhil P. Rao
2026-12-04 22:04 ` Nikhil P. Rao [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=20261204-b4-pr60-v2-5-9e0b5408a68e@amd.com \
--to=nikhil.rao@amd.com \
--cc=abhijit.gangurde@amd.com \
--cc=allen.hubbe@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eric.joyner@amd.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox