Skip to content

Commit f71b74b

Browse files
Frederic Weisbeckeringomolnar
authored andcommitted
irq/softirqs: Use lockdep to assert IRQs are disabled/enabled
Use lockdep to check that IRQs are enabled or disabled as expected. This way the sanity check only shows overhead when concurrency correctness debug code is enabled. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: David S . Miller <davem@davemloft.net> Cc: Lai Jiangshan <jiangshanlai@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/1509980490-4285-3-git-send-email-frederic@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f54bb2e commit f71b74b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎kernel/softirq.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ EXPORT_SYMBOL(__local_bh_disable_ip);
137137

138138
static void __local_bh_enable(unsigned int cnt)
139139
{
140-
WARN_ON_ONCE(!irqs_disabled());
140+
lockdep_assert_irqs_disabled();
141141

142142
if (softirq_count() == (cnt & SOFTIRQ_MASK))
143143
trace_softirqs_on(_RET_IP_);
@@ -158,7 +158,8 @@ EXPORT_SYMBOL(_local_bh_enable);
158158

159159
void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
160160
{
161-
WARN_ON_ONCE(in_irq() || irqs_disabled());
161+
WARN_ON_ONCE(in_irq());
162+
lockdep_assert_irqs_enabled();
162163
#ifdef CONFIG_TRACE_IRQFLAGS
163164
local_irq_disable();
164165
#endif
@@ -396,9 +397,8 @@ void irq_exit(void)
396397
#ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED
397398
local_irq_disable();
398399
#else
399-
WARN_ON_ONCE(!irqs_disabled());
400+
lockdep_assert_irqs_disabled();
400401
#endif
401-
402402
account_irq_exit_time(current);
403403
preempt_count_sub(HARDIRQ_OFFSET);
404404
if (!in_interrupt() && local_softirq_pending())
@@ -488,7 +488,7 @@ EXPORT_SYMBOL(__tasklet_hi_schedule);
488488

489489
void __tasklet_hi_schedule_first(struct tasklet_struct *t)
490490
{
491-
BUG_ON(!irqs_disabled());
491+
lockdep_assert_irqs_disabled();
492492

493493
t->next = __this_cpu_read(tasklet_hi_vec.head);
494494
__this_cpu_write(tasklet_hi_vec.head, t);

0 commit comments

Comments
 (0)