linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/smp: Add irq_enter/exit() in smp_reschedule_interrupt()
@ 2016-10-14  1:48 Wanpeng Li
  2016-10-14 12:19 ` [tip:x86/urgent] " tip-bot for Wanpeng Li
  2016-10-16 13:39 ` [PATCH] " Peter Zijlstra
  0 siblings, 2 replies; 15+ messages in thread
From: Wanpeng Li @ 2016-10-14  1:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Wanpeng Li, Ingo Molnar, Mike Galbraith, Peter Zijlstra, Thomas Gleixner

 ===============================
 [ INFO: suspicious RCU usage. ]
 4.8.0+ #24 Not tainted
 -------------------------------
 ./arch/x86/include/asm/msr-trace.h:47 suspicious rcu_dereference_check() usage!
 
 other info that might help us debug this:
 
 
 RCU used illegally from idle CPU!
 rcu_scheduler_active = 1, debug_locks = 0
 RCU used illegally from extended quiescent state!
 no locks held by swapper/1/0.
 
 stack backtrace:
 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0+ #24
 Hardware name: Dell Inc. OptiPlex 7020/0F5C5X, BIOS A03 01/08/2015
  ffff90285de03f58 ffffffff9d44a0c9 ffff90285ca5d100 0000000000000001
  ffff90285de03f88 ffffffff9d0ebd67 ffff902845165410 000000000000080b
  0000000000000000 0000000000000000 ffff90285de03fb8 ffffffff9d492b95
 Call Trace:
  <IRQ>  [<ffffffff9d44a0c9>] dump_stack+0x99/0xd0
  [<ffffffff9d0ebd67>] lockdep_rcu_suspicious+0xe7/0x120
  [<ffffffff9d492b95>] do_trace_write_msr+0x135/0x140
  [<ffffffff9d06f860>] native_write_msr+0x20/0x30
  [<ffffffff9d065fad>] native_apic_msr_eoi_write+0x1d/0x30
  [<ffffffff9d05bd1d>] smp_reschedule_interrupt+0x1d/0x30
  [<ffffffff9d8daec6>] reschedule_interrupt+0x96/0xa0
  <EOI>  [<ffffffff9d732634>] ? cpuidle_enter_state+0xe4/0x360
  [<ffffffff9d73261f>] ? cpuidle_enter_state+0xcf/0x360
  [<ffffffff9d7328e7>] cpuidle_enter+0x17/0x20
  [<ffffffff9d0e1a73>] call_cpuidle+0x23/0x50
  [<ffffffff9d0e1d0c>] cpu_startup_entry+0x15c/0x280
  [<ffffffff9d05ce64>] start_secondary+0x154/0x180

Reschedule interrupt may be called in cpu idle state. This causes lockdep 
check warning above. 

Add irq_enter/exit() in smp_reschedule_interrupt(), irq_enter() tells the RCU 
subsystems to end the extended quiescent state, so the following trace call in 
ack_APIC_irq() works correctly.

Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 arch/x86/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 658777c..ac2ee87 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -259,8 +259,10 @@ static inline void __smp_reschedule_interrupt(void)
 
 __visible void smp_reschedule_interrupt(struct pt_regs *regs)
 {
+	irq_enter();
 	ack_APIC_irq();
 	__smp_reschedule_interrupt();
+	irq_exit();
 	/*
 	 * KVM uses this interrupt to force a cpu out of guest mode
 	 */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-10-25  2:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-14  1:48 [PATCH] x86/smp: Add irq_enter/exit() in smp_reschedule_interrupt() Wanpeng Li
2016-10-14 12:19 ` [tip:x86/urgent] " tip-bot for Wanpeng Li
2016-10-16 13:39 ` [PATCH] " Peter Zijlstra
2016-10-17  4:19   ` Wanpeng Li
2016-10-17  8:22     ` Peter Zijlstra
2016-10-17  9:45       ` Wanpeng Li
2016-10-17 10:08         ` Paolo Bonzini
2016-10-17 10:23           ` Wanpeng Li
2016-10-18  0:01           ` Wanpeng Li
2016-10-19 14:01             ` Wanpeng Li
2016-10-19 14:10               ` Paolo Bonzini
2016-10-19 14:30                 ` Wanpeng Li
2016-10-24 14:32                   ` Paolo Bonzini
2016-10-25  2:52                     ` Wanpeng Li
2016-10-17 12:19       ` Wanpeng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).