From: Devin Wittmayer <lucid_duck@justthetip.ca>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>
Cc: Deren Wu <deren.wu@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
JB Tsai <jb.tsai@mediatek.com>, Xiong <xiong.huang@mediatek.com>,
Charlie-cy Wu <charlie-cy.wu@mediatek.corp-partner.google.com>,
Quan Zhou <quan.zhou@mediatek.com>,
Eason Lai <eason.lai@mediatek.com>,
Matthew Wilcox <willy@infradead.org>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH wireless] wifi: mt76: mt7921e: fix unregister deadlock
Date: Mon, 2 Nov 2026 15:52:00 -0700 [thread overview]
Message-ID: <20261102225200.16172-1-lucid_duck@justthetip.ca> (raw)
In-Reply-To: <aujjJPq-Qth7UyMp@casper.infradead.org>
Removing the driver can hang forever when the chip stops answering.
Removal disables NAPI and only then waits for the reset work, which a
failing chip keeps queuing. That reset disables NAPI again and never
returns.
Do what mt7925e does: mark the device removed once it is unregistered,
so no new reset is queued, and cancel the reset work before disabling
NAPI.
Fixes: 3d78c46423c6 ("wifi: mt76: mt7921e: stop chip reset worker in unregister hook")
Reported-by: Matthew Wilcox <willy@infradead.org>
Closes: https://lore.kernel.org/all/aujjJPq-Qth7UyMp@casper.infradead.org/
Signed-off-by: Devin Wittmayer <lucid_duck@justthetip.ca>
---
Reproduced on an MT7922 by putting the chip in D3hot under the driver:
the same driver own and chip reset failures, then rmmod waiting in the
same stack while the reset work is stuck disabling NAPI.
dead chip, rmmod result
6.18.52, in-tree hangs
mt76 03dd150dbd36 returns
with this patch returns
75673ab3c0e4 reverted hangs
reverted, with this patch returns, 3 of 3
Since 75673ab3c0e4 the reset stops early when driver own fails, so
current mt76 gets through a fully dead chip. That commit is not in
v7.3, and any reset that gets as far as NAPI still hangs.
This needs the removed check in the reset helper from 79941e85f4b3. A
normal rmmod and a debugfs chip reset work as before.
Matthew, thanks for the stack trace.
drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
index f87c44f2a8b6..1ff219005d14 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
@@ -52,11 +52,12 @@ static void mt7921e_unregister_device(struct mt792x_dev *dev)
cancel_work_sync(&dev->init_work);
mt76_unregister_device(&dev->mt76);
+ set_bit(MT76_REMOVED, &dev->mphy.state);
+ cancel_work_sync(&dev->reset_work);
mt76_for_each_q_rx(&dev->mt76, i)
napi_disable(&dev->mt76.napi[i]);
cancel_delayed_work_sync(&pm->ps_work);
cancel_work_sync(&pm->wake_work);
- cancel_work_sync(&dev->reset_work);
mt76_connac2_tx_token_put(&dev->mt76);
__mt792x_mcu_drv_pmctrl(dev);
@@ -460,7 +461,6 @@ static void mt7921_pci_remove(struct pci_dev *pdev)
device_init_wakeup(dev->mt76.dev, false);
mt7921e_unregister_device(dev);
- set_bit(MT76_REMOVED, &mdev->phy.state);
devm_free_irq(&pdev->dev, pdev->irq, dev);
mt76_free_device(&dev->mt76);
pci_free_irq_vectors(pdev);
--
2.56.0
prev parent reply other threads:[~2026-11-02 22:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 19:23 mt7921e hangs when hardware fails Matthew Wilcox
2026-11-02 22:52 ` Devin Wittmayer [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=20261102225200.16172-1-lucid_duck@justthetip.ca \
--to=lucid_duck@justthetip.ca \
--cc=charlie-cy.wu@mediatek.corp-partner.google.com \
--cc=deren.wu@mediatek.com \
--cc=eason.lai@mediatek.com \
--cc=jb.tsai@mediatek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=quan.zhou@mediatek.com \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=willy@infradead.org \
--cc=xiong.huang@mediatek.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
all inboxes | Powered by JetHome®