diff options
author | Frederic Weisbecker <frederic@kernel.org> | 2017-11-06 10:01:18 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-11-08 05:13:48 -0500 |
commit | f71b74bca637fca7de78f1d44eaefde5bc900f9f (patch) | |
tree | d2b4547b2b7c8f9c04d71048bfd6c53ce7abbfd4 | |
parent | f54bb2ec02c839f6bfe3e8d438cd93d30b4809dd (diff) |
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>
-rw-r--r-- | kernel/softirq.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/softirq.c b/kernel/softirq.c index 4e09821f9d9e..662f7b1b7a78 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -137,7 +137,7 @@ EXPORT_SYMBOL(__local_bh_disable_ip); | |||
137 | 137 | ||
138 | static void __local_bh_enable(unsigned int cnt) | 138 | static void __local_bh_enable(unsigned int cnt) |
139 | { | 139 | { |
140 | WARN_ON_ONCE(!irqs_disabled()); | 140 | lockdep_assert_irqs_disabled(); |
141 | 141 | ||
142 | if (softirq_count() == (cnt & SOFTIRQ_MASK)) | 142 | if (softirq_count() == (cnt & SOFTIRQ_MASK)) |
143 | trace_softirqs_on(_RET_IP_); | 143 | trace_softirqs_on(_RET_IP_); |
@@ -158,7 +158,8 @@ EXPORT_SYMBOL(_local_bh_enable); | |||
158 | 158 | ||
159 | void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) | 159 | void __local_bh_enable_ip(unsigned long ip, unsigned int cnt) |
160 | { | 160 | { |
161 | WARN_ON_ONCE(in_irq() || irqs_disabled()); | 161 | WARN_ON_ONCE(in_irq()); |
162 | lockdep_assert_irqs_enabled(); | ||
162 | #ifdef CONFIG_TRACE_IRQFLAGS | 163 | #ifdef CONFIG_TRACE_IRQFLAGS |
163 | local_irq_disable(); | 164 | local_irq_disable(); |
164 | #endif | 165 | #endif |
@@ -396,9 +397,8 @@ void irq_exit(void) | |||
396 | #ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED | 397 | #ifndef __ARCH_IRQ_EXIT_IRQS_DISABLED |
397 | local_irq_disable(); | 398 | local_irq_disable(); |
398 | #else | 399 | #else |
399 | WARN_ON_ONCE(!irqs_disabled()); | 400 | lockdep_assert_irqs_disabled(); |
400 | #endif | 401 | #endif |
401 | |||
402 | account_irq_exit_time(current); | 402 | account_irq_exit_time(current); |
403 | preempt_count_sub(HARDIRQ_OFFSET); | 403 | preempt_count_sub(HARDIRQ_OFFSET); |
404 | if (!in_interrupt() && local_softirq_pending()) | 404 | if (!in_interrupt() && local_softirq_pending()) |
@@ -488,7 +488,7 @@ EXPORT_SYMBOL(__tasklet_hi_schedule); | |||
488 | 488 | ||
489 | void __tasklet_hi_schedule_first(struct tasklet_struct *t) | 489 | void __tasklet_hi_schedule_first(struct tasklet_struct *t) |
490 | { | 490 | { |
491 | BUG_ON(!irqs_disabled()); | 491 | lockdep_assert_irqs_disabled(); |
492 | 492 | ||
493 | t->next = __this_cpu_read(tasklet_hi_vec.head); | 493 | t->next = __this_cpu_read(tasklet_hi_vec.head); |
494 | __this_cpu_write(tasklet_hi_vec.head, t); | 494 | __this_cpu_write(tasklet_hi_vec.head, t); |