From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Yunseong Kim <ysk@kzalloc.com>,
linux-usb@vger.kernel.org, gregkh@linuxfoundation.org,
Andrey Konovalov <andreyknvl@google.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller@googlegroups.com
Subject: Re: [BUG] usbip: vhci: Sleeping function called from invalid context in vhci_urb_enqueue on PREEMPT_RT
Date: Tue, 19 Aug 2025 13:04:57 +0200 [thread overview]
Message-ID: <20250819110457.I46wiKTe@linutronix.de> (raw)
In-Reply-To: <2bf33071-e05e-4b89-b149-30b90888606f@rowland.harvard.edu>
On 2025-08-17 10:27:11 [-0400], Alan Stern wrote:
> On Sat, Aug 16, 2025 at 10:16:34AM -0400, Alan Stern wrote:
> > So it looks like we should be using a different function instead of
> > local_irq_disable(). We need something which in a non-RT build will
> > disable interrupts on the local CPU, but in an RT build will merely
> > disable preemption. (In fact, every occurrence of local_irq_disable()
> > in the USB subsystem probably should be changed in this way.)
>
> Or maybe what we need is something that in a non-RT build will disable
> local interrupts and in an RT build will do nothing. (I suspect that RT
> kernels won't like it if we call spin_lock() while preemption is
> disabled.)
This is the local_irq_disable() in vhci_urb_enqueue() before
usb_hcd_giveback_urb() is invoked. It was added in 9e8586827a706
("usbip: vhci_hcd: fix calling usb_hcd_giveback_urb() with irqs
enabled").
The warning that fixed back then was
| if (WARN_ON(in_task() && kcov_mode_enabled(mode))) {
which was kernel/kcov.c:834 as of v5.9-rc8 (as of report the mentioned
in the commit).
local_irq_disable() does not change the preemption counter so I am a bit
puzzled why this did shut the warning.
> > Is there such a function?
We could use some API that accidentally does what you ask for. There
would be local_lock_t where local_lock_irq() does that.
What about moving the completion callback to softirq by setting HCD_BH?
> Alan Stern
Sebastian
next prev parent reply other threads:[~2025-08-19 11:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 1:29 [BUG] usbip: vhci: Sleeping function called from invalid context in vhci_urb_enqueue on PREEMPT_RT Yunseong Kim
2025-08-16 1:47 ` Yunseong Kim
2025-08-16 1:51 ` Alan Stern
2025-08-16 2:18 ` Yunseong Kim
2025-08-16 14:16 ` Alan Stern
2025-08-17 14:27 ` Alan Stern
2025-08-19 11:04 ` Sebastian Andrzej Siewior [this message]
2025-08-19 14:12 ` Alan Stern
2025-08-19 14:57 ` Sebastian Andrzej Siewior
2025-08-19 15:44 ` Alan Stern
2025-08-20 16:26 ` Sebastian Andrzej Siewior
2025-08-20 20:53 ` Alan Stern
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=20250819110457.I46wiKTe@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=andreyknvl@google.com \
--cc=clrkwllms@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.org \
--cc=stern@rowland.harvard.edu \
--cc=syzkaller@googlegroups.com \
--cc=tglx@linutronix.de \
--cc=ysk@kzalloc.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