diff mbox series

[2/2] ath10k: detect conf_mutex held ath10k_drain_tx() calls

Message ID 0686097db95ae32ce6805e5163798d912b394f37.1613171185.git.skhan@linuxfoundation.org (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show
Series Add lockdep_assert_not_held() | expand

Commit Message

Shuah Khan Feb. 12, 2021, 11:28 p.m. UTC
ath10k_drain_tx() must not be called with conf_mutex held as workers can
use that also. Add call to lockdep_assert_not_held() on conf_mutex to
detect if conf_mutex is held by the caller.

The idea for this patch stemmed from coming across the comment block
above the ath10k_drain_tx() while reviewing the conf_mutex holds during
to debug the conf_mutex lock assert in ath10k_debug_fw_stats_request().

Adding detection to assert on conf_mutex hold will help detect incorrect
usages that could lead to locking problems when async worker routines try
to call this routine.

Link: https://lore.kernel.org/linux-wireless/871rdmu9z9.fsf@codeaurora.org/
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 drivers/net/wireless/ath/ath10k/mac.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kalle Valo Feb. 14, 2021, 6:08 a.m. UTC | #1
Shuah Khan <skhan@linuxfoundation.org> writes:

> ath10k_drain_tx() must not be called with conf_mutex held as workers can
> use that also. Add call to lockdep_assert_not_held() on conf_mutex to
> detect if conf_mutex is held by the caller.
>
> The idea for this patch stemmed from coming across the comment block
> above the ath10k_drain_tx() while reviewing the conf_mutex holds during
> to debug the conf_mutex lock assert in ath10k_debug_fw_stats_request().
>
> Adding detection to assert on conf_mutex hold will help detect incorrect
> usages that could lead to locking problems when async worker routines try
> to call this routine.
>
> Link: https://lore.kernel.org/linux-wireless/871rdmu9z9.fsf@codeaurora.org/
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

This can go via the same tree as patch 1:

Acked-by: Kalle Valo <kvalo@codeaurora.org>

But I can also take this to my ath tree, once patch 1 has reached it.
Just let me know what is preferred.
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c202b167d8c6..7de05b679ad2 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4728,6 +4728,8 @@  static void ath10k_mac_op_wake_tx_queue(struct ieee80211_hw *hw,
 /* Must not be called with conf_mutex held as workers can use that also. */
 void ath10k_drain_tx(struct ath10k *ar)
 {
+	lockdep_assert_not_held(&ar->conf_mutex);
+
 	/* make sure rcu-protected mac80211 tx path itself is drained */
 	synchronize_net();