Skip to content

Fix ieee80211_color_collision_detection_work() locking

Remi Pommarel linux-wireless lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2wifi: cfg80211: Add wiphy_delayed_work_pending()include/net/cfg80211.h net/wireless/core.c+51 -00 replies
2/2wifi: mac80211: Convert color collision detection to wiphy worknet/mac80211/cfg.c net/mac80211/ieee80211_i.h net/mac80211/link.c+16 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Fix ieee80211_color_collision_detection_work() locking

Call to ieee80211_color_collision_detection_work() needs wiphy lock to be held. This lock cannot be taken directly in the delayed work because it would cause a potential deadlock. Indeed ieee80211_link_stop() is calling cancel_delayed_work_sync() with the lock held. To avoid such deadlock one can use a wiphy delayed work instead.

Thus this patchset convert ieee80211_color_collision_detection_work() to use wiphy delayed work instead of classical delayed work. But because this work is used to ratelimit cfg80211_obss_color_collision_notify() a way to tell if it has already been scheduled is needed as discussed in [0]. In this thread three different solutions has been considered:

- Implementing wiphy_delayed_work_pending() to detect if work can be queued without postponing a previous schedule

- Using a __ratelimit or an equivalent to queue the work

- Modifying wiphy_delayed_work_queue() to mimic queue_delayed_work() by not queuing the work if already queued (while also possibly having to add wiphy_delayed_work_mod() for those who need the mod_delayed_work() behavior).

This patchset implement the first solution.

[0]: https://lore.kernel.org/linux-wireless/[email protected]/

Remi Pommarel (2):
wifi: cfg80211: Add wiphy_delayed_work_pending()
wifi: mac80211: Convert color collision detection to wiphy work

 include/net/cfg80211.h     | 44 ++++++++++++++++++++++++++++++++++++++
 net/mac80211/cfg.c         | 17 ++++++++-------
 net/mac80211/ieee80211_i.h |  5 +++--
 net/mac80211/link.c        |  7 +++---
 net/wireless/core.c        |  7 ++++++
 5 files changed, 67 insertions(+), 13 deletions(-)
Signature · 1 line
2.46.0