From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Leon Yen <leon.yen@mediatek.com>,
Ming Yen Hsieh <MingYen.Hsieh@mediatek.com>,
Felix Fietkau <nbd@nbd.name>, Sasha Levin <sashal@kernel.org>,
lorenzo@kernel.org, ryder.lee@mediatek.com, kvalo@kernel.org,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
deren.wu@mediatek.com, horms@kernel.org,
kernel@mattwhitlock.name, wang.zhao@mediatek.com,
linux-wireless@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH AUTOSEL 6.6 16/21] wifi: mt76: mt7921s: fix potential hung tasks during chip recovery
Date: Mon, 27 May 2024 10:15:27 -0400 [thread overview]
Message-ID: <20240527141551.3853516-16-sashal@kernel.org> (raw)
In-Reply-To: <20240527141551.3853516-1-sashal@kernel.org>
From: Leon Yen <leon.yen@mediatek.com>
[ Upstream commit ecf0b2b8a37c8464186620bef37812a117ff6366 ]
During chip recovery (e.g. chip reset), there is a possible situation that
kernel worker reset_work is holding the lock and waiting for kernel thread
stat_worker to be parked, while stat_worker is waiting for the release of
the same lock.
It causes a deadlock resulting in the dumping of hung tasks messages and
possible rebooting of the device.
This patch prevents the execution of stat_worker during the chip recovery.
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <MingYen.Hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 ++
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c | 2 --
drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c | 2 --
drivers/net/wireless/mediatek/mt76/sdio.c | 3 ++-
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 21f9374542290..cd4eee3749226 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -663,6 +663,7 @@ void mt7921_mac_reset_work(struct work_struct *work)
int i, ret;
dev_dbg(dev->mt76.dev, "chip reset\n");
+ set_bit(MT76_RESET, &dev->mphy.state);
dev->hw_full_reset = true;
ieee80211_stop_queues(hw);
@@ -691,6 +692,7 @@ void mt7921_mac_reset_work(struct work_struct *work)
}
dev->hw_full_reset = false;
+ clear_bit(MT76_RESET, &dev->mphy.state);
pm->suspended = false;
ieee80211_wake_queues(hw);
ieee80211_iterate_active_interfaces(hw,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
index c866144ff0613..031ba9aaa4e2f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c
@@ -64,7 +64,6 @@ int mt7921e_mac_reset(struct mt792x_dev *dev)
mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
- set_bit(MT76_RESET, &dev->mphy.state);
set_bit(MT76_MCU_RESET, &dev->mphy.state);
wake_up(&dev->mt76.mcu.wait);
skb_queue_purge(&dev->mt76.mcu.res_q);
@@ -115,7 +114,6 @@ int mt7921e_mac_reset(struct mt792x_dev *dev)
err = __mt7921_start(&dev->phy);
out:
- clear_bit(MT76_RESET, &dev->mphy.state);
local_bh_disable();
napi_enable(&dev->mt76.tx_napi);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c
index 389eb0903807e..1f77cf71ca701 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c
@@ -98,7 +98,6 @@ int mt7921s_mac_reset(struct mt792x_dev *dev)
mt76_connac_free_pending_tx_skbs(&dev->pm, NULL);
mt76_txq_schedule_all(&dev->mphy);
mt76_worker_disable(&dev->mt76.tx_worker);
- set_bit(MT76_RESET, &dev->mphy.state);
set_bit(MT76_MCU_RESET, &dev->mphy.state);
wake_up(&dev->mt76.mcu.wait);
skb_queue_purge(&dev->mt76.mcu.res_q);
@@ -135,7 +134,6 @@ int mt7921s_mac_reset(struct mt792x_dev *dev)
err = __mt7921_start(&dev->phy);
out:
- clear_bit(MT76_RESET, &dev->mphy.state);
mt76_worker_enable(&dev->mt76.tx_worker);
diff --git a/drivers/net/wireless/mediatek/mt76/sdio.c b/drivers/net/wireless/mediatek/mt76/sdio.c
index c52d550f0c32a..2c761d469c06b 100644
--- a/drivers/net/wireless/mediatek/mt76/sdio.c
+++ b/drivers/net/wireless/mediatek/mt76/sdio.c
@@ -499,7 +499,8 @@ static void mt76s_tx_status_data(struct mt76_worker *worker)
dev = container_of(sdio, struct mt76_dev, sdio);
while (true) {
- if (test_bit(MT76_REMOVED, &dev->phy.state))
+ if (test_bit(MT76_RESET, &dev->phy.state) ||
+ test_bit(MT76_REMOVED, &dev->phy.state))
break;
if (!dev->drv->tx_status_data(dev, &update))
--
2.43.0
next prev parent reply other threads:[~2024-05-27 14:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 14:15 [PATCH AUTOSEL 6.6 01/21] ssb: Fix potential NULL pointer dereference in ssb_device_uevent() Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 02/21] selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 03/21] selftests/bpf: Fix flaky test btf_map_in_map/lookup_update Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 04/21] batman-adv: bypass empty buckets in batadv_purge_orig_ref() Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 05/21] wifi: ath9k: work around memset overflow warning Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 06/21] af_packet: avoid a false positive warning in packet_setsockopt() Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 07/21] ACPI: x86: Add PNP_UART1_SKIP quirk for Lenovo Blade2 tablets Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 08/21] net: sfp: add quirk for another multigig RollBall transceiver Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 09/21] drop_monitor: replace spin_lock by raw_spin_lock Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 10/21] scsi: qedi: Fix crash while reading debugfs attribute Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 11/21] net: sfp: add quirk for ATS SFP-GE-T 1000Base-TX module Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 12/21] net/sched: fix false lockdep warning on qdisc root lock Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 13/21] kselftest: arm64: Add a null pointer check Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 14/21] net: dsa: realtek: keep default LED state in rtl8366rb Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 15/21] netpoll: Fix race condition in netpoll_owner_active Sasha Levin
2024-05-27 14:15 ` Sasha Levin [this message]
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 17/21] HID: Add quirk for Logitech Casa touchpad Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 18/21] HID: asus: fix more n-key report descriptors if n-key quirked Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 19/21] ACPI: video: Add backlight=native quirk for Lenovo Slim 7 16ARH7 Sasha Levin
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 20/21] HID: bpf: add in-tree HID-BPF fix for the HP Elite Presenter Mouse Sasha Levin
2024-05-27 14:49 ` Benjamin Tissoires
2024-05-27 14:15 ` [PATCH AUTOSEL 6.6 21/21] Bluetooth: ath3k: Fix multiple issues reported by checkpatch.pl Sasha Levin
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=20240527141551.3853516-16-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=MingYen.Hsieh@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=deren.wu@mediatek.com \
--cc=horms@kernel.org \
--cc=kernel@mattwhitlock.name \
--cc=kvalo@kernel.org \
--cc=leon.yen@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=stable@vger.kernel.org \
--cc=wang.zhao@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