linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] mac80211: Potential sleep in atomic context in __ieee80211_wake_txqs
@ 2025-08-18 16:56 Yunseong Kim
  2025-08-19 10:10 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: Yunseong Kim @ 2025-08-18 16:56 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Sebastian Andrzej Siewior, Clark Williams, Steven Rostedt,
	Jiri Kosina, Aaron Hill, Lukas Redlinger, Oleksii Shevchuk,
	Toke Høiland-Jørgensen, linux-wireless, linux-rt-devel,
	LKML

Hi,

I found a potential PREEMPT_RT issue I noticed in __ieee80211_wake_txqs()

 static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
 {
     ...
     local_bh_disable();
     spin_lock(&fq->lock);
     ...
 }

This sequence of local_bh_disable() followed by spin_lock(). On an 
RT-enabled system, spin_lock() is converted to a sleeping lock. Calling it
immediately after local_bh_disable() creates a situation where a sleeping
function is called from an atomic context, which will lead to a sleep in
atomic context if the lock is contended.

The conventional fix for this pattern is to replace the two lines with a
single, RT-safe call to spin_lock_bh(&fq->lock).

I wanted to bring this up for discussion before preparing a patch. Is this
a valid concern, and would a patch to correct this locking be the right
approach?

Thank you for your time and consideration.


Best regards,
Yunseong Kim

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] mac80211: Potential sleep in atomic context in __ieee80211_wake_txqs
  2025-08-18 16:56 [RFC] mac80211: Potential sleep in atomic context in __ieee80211_wake_txqs Yunseong Kim
@ 2025-08-19 10:10 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-08-19 10:10 UTC (permalink / raw)
  To: Yunseong Kim
  Cc: Johannes Berg, Clark Williams, Steven Rostedt, Jiri Kosina,
	Aaron Hill, Lukas Redlinger, Oleksii Shevchuk,
	Toke Høiland-Jørgensen, linux-wireless, linux-rt-devel,
	LKML

On 2025-08-19 01:56:00 [+0900], Yunseong Kim wrote:
> Hi,
Hi,

> I found a potential PREEMPT_RT issue I noticed in __ieee80211_wake_txqs()
> 
>  static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)
>  {
>      ...
>      local_bh_disable();
>      spin_lock(&fq->lock);
>      ...
>  }
> 
> This sequence of local_bh_disable() followed by spin_lock(). On an 

As explained in the previous mail regarding for
inet_twsk_hashdance_schedule(), this is fine.

> Best regards,
> Yunseong Kim

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-19 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 16:56 [RFC] mac80211: Potential sleep in atomic context in __ieee80211_wake_txqs Yunseong Kim
2025-08-19 10:10 ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).