Skip to content

Commit f1a0898

Browse files
Hugh Dickinsjmberg-intel
authored andcommitted
wifi: iwlwifi: mvm: spin_lock_bh() to fix lockdep regression
Lockdep on 6.4-rc on ThinkPad X1 Carbon 5th says ===================================================== WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected 6.4.0-rc5 #1 Not tainted ----------------------------------------------------- kworker/3:1/49 [HC0[0]:SC0[4]:HE1:SE0] is trying to acquire: ffff8881066fa368 (&mvm_sta->deflink.lq_sta.rs_drv.pers.lock){+.+.}-{2:2}, at: rs_drv_get_rate+0x46/0xe7 and this task is already holding: ffff8881066f80a8 (&sta->rate_ctrl_lock){+.-.}-{2:2}, at: rate_control_get_rate+0xbd/0x126 which would create a new lock dependency: (&sta->rate_ctrl_lock){+.-.}-{2:2} -> (&mvm_sta->deflink.lq_sta.rs_drv.pers.lock){+.+.}-{2:2} but this new dependency connects a SOFTIRQ-irq-safe lock: (&sta->rate_ctrl_lock){+.-.}-{2:2} etc. etc. etc. Changing the spin_lock() in rs_drv_get_rate() to spin_lock_bh() was not enough to pacify lockdep, but changing them all on pers.lock has worked. Fixes: a8938bc ("wifi: iwlwifi: mvm: Add locking to the rate read flow") Signed-off-by: Hugh Dickins <hughd@google.com> Link: https://lore.kernel.org/r/79ffcc22-9775-cb6d-3ffd-1a517c40beef@google.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent d094482 commit f1a0898

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • drivers/net/wireless/intel/iwlwifi/mvm

drivers/net/wireless/intel/iwlwifi/mvm/rs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
26922692

26932693
lq_sta = mvm_sta;
26942694

2695-
spin_lock(&lq_sta->pers.lock);
2695+
spin_lock_bh(&lq_sta->pers.lock);
26962696
iwl_mvm_hwrate_to_tx_rate_v1(lq_sta->last_rate_n_flags,
26972697
info->band, &info->control.rates[0]);
26982698
info->control.rates[0].count = 1;
@@ -2707,7 +2707,7 @@ static void rs_drv_get_rate(void *mvm_r, struct ieee80211_sta *sta,
27072707
iwl_mvm_hwrate_to_tx_rate_v1(last_ucode_rate, info->band,
27082708
&txrc->reported_rate);
27092709
}
2710-
spin_unlock(&lq_sta->pers.lock);
2710+
spin_unlock_bh(&lq_sta->pers.lock);
27112711
}
27122712

27132713
static void *rs_drv_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta,
@@ -3264,11 +3264,11 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
32643264
/* If it's locked we are in middle of init flow
32653265
* just wait for next tx status to update the lq_sta data
32663266
*/
3267-
if (!spin_trylock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock))
3267+
if (!spin_trylock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock))
32683268
return;
32693269

32703270
__iwl_mvm_rs_tx_status(mvm, sta, tid, info, ndp);
3271-
spin_unlock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
3271+
spin_unlock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
32723272
}
32733273

32743274
#ifdef CONFIG_MAC80211_DEBUGFS
@@ -4117,9 +4117,9 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm,
41174117
} else {
41184118
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
41194119

4120-
spin_lock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
4120+
spin_lock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
41214121
rs_drv_rate_init(mvm, sta, band);
4122-
spin_unlock(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
4122+
spin_unlock_bh(&mvmsta->deflink.lq_sta.rs_drv.pers.lock);
41234123
}
41244124
}
41254125

0 commit comments

Comments
 (0)