Skip to content

Commit 87886b3

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
lockdep: Don't disable interrupts on RT in disable_irq_nosync_lockdep.*()
disable_irq_nosync_lockdep() disables interrupts with lockdep enabled to avoid false positive reports by lockdep that a certain lock has not been acquired with disabled interrupts. The user of this macros expects that a lock can be acquried without disabling interrupts because the IRQ line triggering the interrupt is disabled. This triggers a warning on PREEMPT_RT because after disable_irq_nosync_lockdep.*() the following spinlock_t now is acquired with disabled interrupts. On PREEMPT_RT there is no difference between spin_lock() and spin_lock_irq() so avoiding disabling interrupts in this case works for the two remaining callers as of today. Don't disable interrupts on PREEMPT_RT in disable_irq_nosync_lockdep.*(). Closes: https://lore.kernel.org/760e34f9-6034-40e0-82a5-ee9becd24438@roeck-us.net Fixes: e8106b9 ("[PATCH] lockdep: core, add enable/disable_irq_irqsave/irqrestore() APIs") Reported-by: Guenter Roeck <linux@roeck-us.net> Suggested-by: "Steven Rostedt (Google)" <rostedt@goodmis.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20250212103619.2560503-2-bigeasy@linutronix.de
1 parent f73ca66 commit 87886b3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/linux/interrupt.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,15 +448,15 @@ irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
448448
static inline void disable_irq_nosync_lockdep(unsigned int irq)
449449
{
450450
disable_irq_nosync(irq);
451-
#ifdef CONFIG_LOCKDEP
451+
#if defined(CONFIG_LOCKDEP) && !defined(CONFIG_PREEMPT_RT)
452452
local_irq_disable();
453453
#endif
454454
}
455455

456456
static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
457457
{
458458
disable_irq_nosync(irq);
459-
#ifdef CONFIG_LOCKDEP
459+
#if defined(CONFIG_LOCKDEP) && !defined(CONFIG_PREEMPT_RT)
460460
local_irq_save(*flags);
461461
#endif
462462
}
@@ -471,15 +471,15 @@ static inline void disable_irq_lockdep(unsigned int irq)
471471

472472
static inline void enable_irq_lockdep(unsigned int irq)
473473
{
474-
#ifdef CONFIG_LOCKDEP
474+
#if defined(CONFIG_LOCKDEP) && !defined(CONFIG_PREEMPT_RT)
475475
local_irq_enable();
476476
#endif
477477
enable_irq(irq);
478478
}
479479

480480
static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
481481
{
482-
#ifdef CONFIG_LOCKDEP
482+
#if defined(CONFIG_LOCKDEP) && !defined(CONFIG_PREEMPT_RT)
483483
local_irq_restore(*flags);
484484
#endif
485485
enable_irq(irq);

0 commit comments

Comments
 (0)