Message ID | b10be44b0f968475268895b99864973d18a3b86e.1655944385.git.objelf@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] mt76: mt7921: reduce log severity levels for informative messages | expand |
Il 23/06/22 02:35, sean.wang@mediatek.com ha scritto: > From: Sean Wang <sean.wang@mediatek.com> > > Reduce the mutex lock scope for reset to get rid of possible task hung > e.g wpa_supplicant and to allow the user-space process to keep running > during we need more retries to complete the reset. > To actually, effectively, reduce the chance to get a hung task, and also to improve the general responsiveness, I think that the best way would be to manage the locking inside of the reset callback(s) for each dev/bus. This is especially because some of these reset functions (like the SDIO one) may end up waiting for more than *two seconds*. However, I get that this proposal requires way more effort, and this commit will anyway improve the situation as it is... so, you get my: Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > Suggested-by: YN Chen <YN.Chen@mediatek.com> > Signed-off-by: Sean Wang <sean.wang@mediatek.com>
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 2ce3a833176e..c7bca83e7686 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -738,7 +738,7 @@ void mt7921_mac_reset_work(struct work_struct *work) reset_work); struct ieee80211_hw *hw = mt76_hw(dev); struct mt76_connac_pm *pm = &dev->pm; - int i; + int i, ret; dev_info(dev->mt76.dev, "chip reset\n"); dev->hw_full_reset = true; @@ -748,11 +748,14 @@ void mt7921_mac_reset_work(struct work_struct *work) cancel_delayed_work_sync(&pm->ps_work); cancel_work_sync(&pm->wake_work); - mutex_lock(&dev->mt76.mutex); - for (i = 0; i < 10; i++) - if (!mt7921_dev_reset(dev)) + for (i = 0; i < 10; i++) { + mutex_lock(&dev->mt76.mutex); + ret = mt7921_dev_reset(dev); + mutex_unlock(&dev->mt76.mutex); + + if (!ret) break; - mutex_unlock(&dev->mt76.mutex); + } if (i == 10) dev_err(dev->mt76.dev, "chip reset failed\n");