aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2017-11-06 10:01:23 -0500
committerIngo Molnar <mingo@kernel.org>2017-11-08 05:13:50 -0500
commit7a10e2a9190628a4024ea394ce7bd641ae40ffd1 (patch)
treee87b2bec06bfc28654d4ba7848b2ed91e65a67bd
parent83efcbd028ad3aec36b5a3882cfa32490c135df7 (diff)
x86: 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. It also makes no more sense to fix the IRQ flags when a bug is detected as the assertion is now pure config-dependent debugging. And to quote Peter Zijlstra: The whole if !disabled, disable logic is uber paranoid programming, but I don't think we've ever seen that WARN trigger, and if it does (and then burns the kernel) we at least know what happend. 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-8-git-send-email-frederic@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/entry/common.c4
-rw-r--r--arch/x86/kernel/smpboot.c2
2 files changed, 2 insertions, 4 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index eaa0ba66cf96..d7d3cc24baf4 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -186,9 +186,7 @@ __visible inline void prepare_exit_to_usermode(struct pt_regs *regs)
186 186
187 addr_limit_user_check(); 187 addr_limit_user_check();
188 188
189 if (IS_ENABLED(CONFIG_PROVE_LOCKING) && WARN_ON(!irqs_disabled())) 189 lockdep_assert_irqs_disabled();
190 local_irq_disable();
191
192 lockdep_sys_exit(); 190 lockdep_sys_exit();
193 191
194 cached_flags = READ_ONCE(ti->flags); 192 cached_flags = READ_ONCE(ti->flags);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 198416ddff01..4008b6b9ad72 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1095,7 +1095,7 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
1095 unsigned long flags; 1095 unsigned long flags;
1096 int err, ret = 0; 1096 int err, ret = 0;
1097 1097
1098 WARN_ON(irqs_disabled()); 1098 lockdep_assert_irqs_enabled();
1099 1099
1100 pr_debug("++++++++++++++++++++=_---CPU UP %u\n", cpu); 1100 pr_debug("++++++++++++++++++++=_---CPU UP %u\n", cpu);
1101 1101