From: "bigeasy@linutronix.de" <bigeasy@linutronix.de>
To: "Sverdlin, Alexander" <alexander.sverdlin@siemens.com>
Cc: "mingo@kernel.org" <mingo@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"paulmck@kernel.org" <paulmck@kernel.org>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"will@kernel.org" <will@kernel.org>,
"joel@joelfernandes.org" <joel@joelfernandes.org>
Subject: Re: [PATCH 6/9] lockdep: Introduce wait-type checks
Date: Mon, 17 Nov 2025 14:55:05 +0100 [thread overview]
Message-ID: <20251117135505.K9WJefrH@linutronix.de> (raw)
In-Reply-To: <b8cb2c4084f2cfe0eff68415b502b4e352704401.camel@siemens.com>
On 2025-11-17 13:42:40 [+0000], Sverdlin, Alexander wrote:
> Hello Peter and all,
>
> I'm trying to understand the splat I've got with v6.18-rc1:
>
> =============================
> [ BUG: Invalid wait context ]
> 6.18.0-rc1+git476309497a53 #1 Tainted: G O
> -----------------------------
> some-user-space-process/1251 is trying to lock:
> ffff000005cbc548 (&counter->events_list_lock){....}-{3:3}, at: counter_push_event+0x68/0x430 [counter]
> other info that might help us debug this:
> context-{2:2}
> no locks held by some-user-space-process/1251.
> stack backtrace:
> CPU: 0 UID: 0 PID: 1251 Comm: some-user-space-process Tainted: G O 6.18.0-rc1+git476309497a53 #1 PREEMPT
> Call trace:
> show_stack+0x20/0x38 (C)
> dump_stack_lvl+0x8c/0xd0
> dump_stack+0x18/0x28
> __lock_acquire+0x91c/0x1f78
> lock_acquire+0x1c4/0x338
> _raw_spin_lock_irqsave+0x68/0x98
> counter_push_event+0x68/0x430 [counter]
> interrupt_cnt_isr+0x40/0x78 [interrupt_cnt]
> __handle_irq_event_percpu+0xa4/0x398
> handle_irq_event+0x54/0xb8
> handle_simple_irq+0xe4/0x128
> handle_irq_desc+0x48/0x68
> generic_handle_domain_irq+0x24/0x38
> gpio_irq_handler+0xa0/0x140
> handle_irq_desc+0x48/0x68
> generic_handle_domain_irq+0x24/0x38
> gic_handle_irq+0x54/0x128
> call_on_irq_stack+0x30/0x70
> do_interrupt_handler+0x88/0x98
> el0_interrupt+0x5c/0x270
> __el0_irq_handler_common+0x18/0x28
> el0t_64_irq_handler+0x10/0x20
> el0t_64_irq+0x198/0x1a0
>
> This is not PREEMPT_RT, but still CONFIG_PROVE_RAW_LOCK_NESTING=y config...
> The relevant logic in the current v6.18-rcX is still largely unchanged
> from the Subject commit and...
>
The validation is not limited to PREEMPT_RT enabled.
…
> > diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> > index 32406ef0d6a2d..4a9abf8bd9d15 100644
> > --- a/kernel/locking/lockdep.c
> > +++ b/kernel/locking/lockdep.c
…
> > + * Set appropriate wait type for the context; for IRQs we have to take
> > + * into account force_irqthread as that is implied by PREEMPT_RT.
> > + */
> > + if (curr->hardirq_context) {
> > + /*
> > + * Check if force_irqthreads will run us threaded.
> > + */
> > + if (curr->hardirq_threaded)
> > + curr_inner = LD_WAIT_CONFIG;
> > + else
> > + curr_inner = LD_WAIT_SPIN;
>
> ... even though it's "if (curr->hardirq_threaded || curr->irq_config)" in the
> meanwhile, it is unclear to me, why is it conditional at all and not always
> "LD_WAIT_CONFIG" in hardirq context?
>
> With !PREEMPT_RT but CONFIG_PROVE_RAW_LOCK_NESTING=y we always end up
> with LD_WAIT_SPIN here and it always warns if we take "spinlock_t" in hardirq
> context (as in the splat above). But the latter should be legal under all
> circumstances, isn't it?
Nope. The validation is performed always. The architectures which don't
support PREEMPT_RT are excluded for $reasons that is why
PROVE_RAW_LOCK_NESTING remains an option there.
A spinlock_t is a sleeping lock in a PREEMPT_RT context and the
interrupt hander are threaded. In this case a spinlock_t is okay.
However, if a spinlock_t is used in a non-forced-threaded environment
(such as in a primary handler with IRQF_NO_THREAD) then this handler
will not be threaded. Therefore spinlock_t is not a valid class.
Sebastian
next prev parent reply other threads:[~2025-11-17 13:55 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 17:46 [PATCH 0/9] Lock ordering documentation and annotation for lockdep Sebastian Andrzej Siewior
2020-03-13 17:46 ` [PATCH 1/9] Documentation: Add lock ordering and nesting documentation Sebastian Andrzej Siewior
2020-03-14 22:57 ` Randy Dunlap
2020-03-16 10:34 ` Sebastian Andrzej Siewior
2020-03-16 15:13 ` Randy Dunlap
2020-03-13 17:46 ` [PATCH 2/9] timekeeping: Split jiffies seqlock Sebastian Andrzej Siewior
2020-03-13 17:46 ` [PATCH 3/9] pci/switchtec: Don't abuse completion wait queue for poll Sebastian Andrzej Siewior
2020-03-13 18:11 ` Logan Gunthorpe
2020-03-14 0:23 ` Thomas Gleixner
2020-03-14 6:01 ` Logan Gunthorpe
2020-03-16 18:52 ` Thomas Gleixner
2020-03-16 19:24 ` Logan Gunthorpe
2020-03-16 19:34 ` Thomas Gleixner
2020-03-16 21:53 ` Logan Gunthorpe
2020-03-17 0:17 ` Thomas Gleixner
2020-03-17 1:15 ` Logan Gunthorpe
2020-03-13 19:31 ` Peter Zijlstra
2020-03-13 17:46 ` [PATCH 4/9] sched/swait: Prepare usage in completions Sebastian Andrzej Siewior
2020-03-14 0:26 ` Thomas Gleixner
2020-03-13 17:46 ` [PATCH 5/9] completion: Use simple wait queues Sebastian Andrzej Siewior
2020-03-14 15:40 ` Linus Torvalds
2020-03-16 18:55 ` Thomas Gleixner
2020-03-13 17:46 ` [PATCH 6/9] lockdep: Introduce wait-type checks Sebastian Andrzej Siewior
2020-03-31 13:25 ` Geert Uytterhoeven
2020-03-31 13:42 ` Sebastian Andrzej Siewior
2020-03-31 14:55 ` Peter Zijlstra
2020-03-31 15:28 ` Peter Zijlstra
2020-03-31 15:37 ` Frederic Weisbecker
2025-11-17 13:42 ` Sverdlin, Alexander
2025-11-17 13:55 ` bigeasy [this message]
2025-11-17 14:23 ` Sverdlin, Alexander
2025-11-17 14:37 ` Paul E. McKenney
2025-11-17 14:59 ` Sverdlin, Alexander
2025-11-17 15:13 ` bigeasy
2025-11-17 15:28 ` Sverdlin, Alexander
2020-03-13 17:46 ` [PATCH 7/9] lockdep: Add hrtimer context tracing bits Sebastian Andrzej Siewior
2020-03-13 17:47 ` [PATCH 8/9] lockdep: Annotate irq_work Sebastian Andrzej Siewior
2020-03-13 17:47 ` [PATCH 9/9] lockdep: Add posixtimer context tracing bits 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=20251117135505.K9WJefrH@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=alexander.sverdlin@siemens.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will@kernel.org \
/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®