mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunseong Kim <ysk@kzalloc.com>
To: Johannes Berg <johannes.berg@intel.com>
Cc: "Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Clark Williams" <clrkwllms@kernel.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Jiri Kosina" <jkosina@suse.cz>,
	"Aaron Hill" <aa1ronham@gmail.com>,
	"Lukas Redlinger" <rel+kernel@agilox.net>,
	"Oleksii Shevchuk" <alxchk@gmail.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	linux-wireless@vger.kernel.org, linux-rt-devel@lists.linux.dev,
	LKML <linux-kernel@vger.kernel.org>
Subject: [RFC] mac80211: Potential sleep in atomic context in __ieee80211_wake_txqs
Date: Tue, 19 Aug 2025 01:56:00 +0900	[thread overview]
Message-ID: <c15a819a-51de-467c-93fd-c321dd2e8ec9@kzalloc.com> (raw)

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

             reply	other threads:[~2025-08-18 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 16:56 Yunseong Kim [this message]
2025-08-19 10:10 ` Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c15a819a-51de-467c-93fd-c321dd2e8ec9@kzalloc.com \
    --to=ysk@kzalloc.com \
    --cc=aa1ronham@gmail.com \
    --cc=alxchk@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=clrkwllms@kernel.org \
    --cc=jkosina@suse.cz \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rel+kernel@agilox.net \
    --cc=rostedt@goodmis.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®