Commit f71b74bc authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

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: default avatarFrederic Weisbecker <frederic@kernel.org>
Acked-by: default avatarThomas 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.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent f54bb2ec
...@@ -137,7 +137,7 @@ EXPORT_SYMBOL(__local_bh_disable_ip); ...@@ -137,7 +137,7 @@ EXPORT_SYMBOL(__local_bh_disable_ip);
static void __local_bh_enable(unsigned int cnt) static void __local_bh_enable(unsigned int cnt)
{ {
WARN_ON_ONCE(!irqs_disabled()); lockdep_assert_irqs_disabled();
if (softirq_count() == (cnt & SOFTIRQ_MASK)) if (softirq_count() == (cnt & SOFTIRQ_MASK))
trace_softirqs_on(_RET_IP_); trace_softirqs_on(_RET_IP_);
...@@ -158,7 +158,8 @@ EXPORT_SYMBOL(_local_bh_enable); ...@@ -158,7 +158,8 @@ EXPORT_SYMBOL(_local_bh_enable);
void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
{ {
WARN_ON_ONCE(in_irq() || irqs_disabled()); WARN_ON_ONCE(in_irq());
lockdep_assert_irqs_enabled();
#ifdef CONFIG_TRACE_IRQFLAGS #ifdef CONFIG_TRACE_IRQFLAGS
local_irq_disable(); local_irq_disable();
#endif #endif
...@@ -396,9 +397,8 @@ void irq_exit(void) ...@@ -396,9 +397,8 @@ void irq_exit(void)
#ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED #ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED
local_irq_disable(); local_irq_disable();
#else #else
WARN_ON_ONCE(!irqs_disabled()); lockdep_assert_irqs_disabled();
#endif #endif
account_irq_exit_time(current); account_irq_exit_time(current);
preempt_count_sub(HARDIRQ_OFFSET); preempt_count_sub(HARDIRQ_OFFSET);
if (!in_interrupt() && local_softirq_pending()) if (!in_interrupt() && local_softirq_pending())
...@@ -488,7 +488,7 @@ EXPORT_SYMBOL(__tasklet_hi_schedule); ...@@ -488,7 +488,7 @@ EXPORT_SYMBOL(__tasklet_hi_schedule);
void __tasklet_hi_schedule_first(struct tasklet_struct *t) void __tasklet_hi_schedule_first(struct tasklet_struct *t)
{ {
BUG_ON(!irqs_disabled()); lockdep_assert_irqs_disabled();
t->next = __this_cpu_read(tasklet_hi_vec.head); t->next = __this_cpu_read(tasklet_hi_vec.head);
__this_cpu_write(tasklet_hi_vec.head, t); __this_cpu_write(tasklet_hi_vec.head, t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment