From: Steven Rostedt <rostedt@goodmis.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
linux-rt-devel@lists.linux.dev,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: Backtrace seen when enabling PREEMPT_RT
Date: Tue, 11 Feb 2025 18:21:13 -0500 [thread overview]
Message-ID: <20250211182113.4875751a@gandalf.local.home> (raw)
In-Reply-To: <bfecd294-d68d-4e71-af43-b19c59012c98@roeck-us.net>
On Tue, 11 Feb 2025 14:54:47 -0800
Guenter Roeck <linux@roeck-us.net> wrote:
> Does this help ?
Yes.
>
> [ 13.163019] hardirqs last enabled at (52626): _raw_spin_unlock_irqrestore (arch/x86/include/asm/irqflags.h:26 arch/x86/include/asm/irqflags.h:87 arch/x86/include/asm/irqflags.h:147 include/linux/spinlock_api_smp.h:151 kernel/locking/spinlock.c:194)
> [ 13.163030] hardirqs last disabled at (52627): ei_start_xmit (include/linux/interrupt.h:460 (discriminator 1) drivers/net/ethernet/8390/lib8390.c:333 (discriminator 1) drivers/net/ethernet/8390/8390.c:23 (discriminator 1))
Ug, we have in __ei_start_xmit():
/*
* Slow phase with lock held.
*/
disable_irq_nosync_lockdep_irqsave(dev->irq, &flags);
spin_lock(&ei_local->page_lock);
Where we have:
static inline void disable_irq_nosync_lockdep(unsigned int irq)
{
disable_irq_nosync(irq);
#ifdef CONFIG_LOCKDEP
local_irq_disable();
#endif
}
Where when we have LOCKDEP enabled, it disables interrupts. But as you can
see, that's going to trigger the warning:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
Because the spin_lock() is a mutex when PREEMPT_RT is enabled, but now we
have interrupts disabled when LOCKDEP in enabled.
Peter, should that be:
static inline void disable_irq_nosync_lockdep(unsigned int irq)
{
disable_irq_nosync(irq);
#if defined(CONFIG_LOCKDEP) && !defined(CONFIG_PREEMPT_RT)
local_irq_disable();
#endif
}
Or is that just wishful thinking that this would be solved by such a simple
solution (of course the enable_irq() version also needs to be updated).
-- Steve
> [ 13.163038] softirqs last enabled at (52602): __local_bh_enable_ip (kernel/softirq.c:247)
> [ 13.163046] softirqs last disabled at (52608): __dev_queue_xmit (include/linux/bottom_half.h:20 (discriminator 1) include/linux/rcupdate.h:901 (discriminator 1) net/core/dev.c:4509 (discriminator 1))
> [ 13.163257] CPU: 2 UID: 0 PID: 59 Comm: kworker/2:1 Tainted: G N 6.14.0-rc2-00008-g3309945911b8 #1
> [ 13.163300] Tainted: [N]=TEST
> [ 13.163307] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
> [ 13.163376] Workqueue: mld mld_ifc_work
> [ 13.163466] Call Trace:
> [ 13.163501] <TASK>
> [ 13.163544] dump_stack_lvl (lib/dump_stack.c:123)
> [ 13.163584] __might_resched (kernel/sched/core.c:8767)
> [ 13.163607] rt_spin_lock (kernel/locking/spinlock_rt.c:40 kernel/locking/spinlock_rt.c:49 kernel/locking/spinlock_rt.c:57)
> [ 13.163618] ? ei_start_xmit (drivers/net/ethernet/8390/lib8390.c:337 drivers/net/ethernet/8390/8390.c:23)
> [ 13.163625] ? __disable_irq_nosync (kernel/irq/manage.c:702)
> [ 13.163638] ei_start_xmit (drivers/net/ethernet/8390/lib8390.c:337 drivers/net/ethernet/8390/8390.c:23)
> [ 13.163642] ? lock_acquire.part.0 (kernel/locking/lockdep.c:469 (discriminator 4) kernel/locking/lockdep.c:5853 (discriminator 4))
> [ 13.163685] dev_hard_start_xmit (include/linux/netdevice.h:5144 include/linux/netdevice.h:5153 net/core/dev.c:3735 net/core/dev.c:3751)
> [ 13.163709] sch_direct_xmit (net/sched/sch_generic.c:343)
> [ 13.163735] __dev_queue_xmit (net/core/dev.c:3974 (discriminator 1) net/core/dev.c:4550 (discriminator 1))
> [ 13.163751] ? lock_acquire.part.0 (kernel/locking/lockdep.c:469 (discriminator 4) kernel/locking/lockdep.c:5853 (discriminator 4))
> [ 13.163760] ? find_held_lock (kernel/locking/lockdep.c:5341 (discriminator 1))
> [ 13.163778] ? mark_held_locks (kernel/locking/lockdep.c:4323 (discriminator 1))
> [ 13.163790] ? eth_header (net/ethernet/eth.c:85)
> [ 13.163819] ip6_finish_output2 (include/net/neighbour.h:539 (discriminator 2) net/ipv6/ip6_output.c:141 (discriminator 2))
> [ 13.163843] ? ip6_mtu (net/ipv6/route.c:3220)
> [ 13.163869] mld_sendpack (net/ipv6/mcast.c:1866)
> [ 13.163918] mld_ifc_work (net/ipv6/mcast.c:2699)
> [ 13.163940] process_one_work (kernel/workqueue.c:3241)
> [ 13.163979] worker_thread (kernel/workqueue.c:3311 (discriminator 2) kernel/workqueue.c:3398 (discriminator 2))
> [ 13.163993] ? __pfx_worker_thread (kernel/workqueue.c:3344)
> [ 13.164000] kthread (kernel/kthread.c:464)
> [ 13.164015] ? __pfx_kthread (kernel/kthread.c:413)
> [ 13.164030] ret_from_fork (arch/x86/kernel/process.c:154)
> [ 13.164036] ? __pfx_kthread (kernel/kthread.c:413)
> [ 13.164046] ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
next prev parent reply other threads:[~2025-02-11 23:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 16:12 Backtrace seen when enabling PREEMPT_RT Guenter Roeck
2025-02-11 17:22 ` Steven Rostedt
2025-02-11 22:54 ` Guenter Roeck
2025-02-11 23:21 ` Steven Rostedt [this message]
2025-02-12 10:36 ` [PATCH 0/2] lockdep: disable_irq_nosync_lockdep.*() for PREEMPT_RT Sebastian Andrzej Siewior
2025-02-12 10:36 ` [PATCH 1/2] lockdep: Don't disable interrupts on RT in disable_irq_nosync_lockdep.*() Sebastian Andrzej Siewior
2025-02-12 14:11 ` Guenter Roeck
2025-02-12 14:49 ` Steven Rostedt
2025-02-21 17:12 ` Boqun Feng
2025-03-14 20:23 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-02-12 10:36 ` [PATCH 2/2] lockdep: Remove disable_irq_lockdep() Sebastian Andrzej Siewior
2025-02-12 14:11 ` Guenter Roeck
2025-03-14 20:23 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2025-02-21 16:35 ` [PATCH 0/2] lockdep: disable_irq_nosync_lockdep.*() for PREEMPT_RT 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=20250211182113.4875751a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux@roeck-us.net \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.