diff options
author | Yoshihiro YUNOMAE <[email protected]> | 2013-08-20 16:01:07 +0900 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2013-08-20 09:26:33 +0200 |
commit | 17405453f4ad0220721a29978692081be6392b8f (patch) | |
tree | 216fe126cfe8b3d1831ab63d1c2bdd74093270db /tools/perf/util/trace-event-scripting.c | |
parent | 82982d729319e975115d88cae4927dffb02bfea7 (diff) |
x86/ioapic/kcrash: Prevent crash_kexec() from deadlocking on ioapic_lock
Prevent crash_kexec() from deadlocking on ioapic_lock. When
crash_kexec() is executed on a CPU, the CPU will take ioapic_lock
in disable_IO_APIC(). So if the cpu gets an NMI while locking
ioapic_lock, a deadlock will happen.
In this patch, ioapic_lock is zapped/initialized before disable_IO_APIC().
You can reproduce this deadlock the following way:
1. Add mdelay(1000) after raw_spin_lock_irqsave() in
native_ioapic_set_affinity()@arch/x86/kernel/apic/io_apic.c
Although the deadlock can occur without this modification, it will increase
the potential of the deadlock problem.
2. Build and install the kernel
3. Set up the OS which will run panic() and kexec when NMI is injected
# echo "kernel.unknown_nmi_panic=1" >> /etc/sysctl.conf
# vim /etc/default/grub
add "nmi_watchdog=0 crashkernel=256M" in GRUB_CMDLINE_LINUX line
# grub2-mkconfig
4. Reboot the OS
5. Run following command for each vcpu on the guest
# while true; do echo <CPU num> > /proc/irq/<IO-APIC-edge or IO-APIC-fasteoi>/smp_affinitity; done;
By running this command, cpus will get ioapic_lock for setting affinity.
6. Inject NMI (push a dump button or execute 'virsh inject-nmi <domain>' if you
use VM). After injecting NMI, panic() is called in an nmi-handler context.
Then, kexec will normally run in panic(), but the operation will be stopped
by deadlock on ioapic_lock in crash_kexec()->machine_crash_shutdown()->
native_machine_crash_shutdown()->disable_IO_APIC()->clear_IO_APIC()->
clear_IO_APIC_pin()->ioapic_read_entry().
Signed-off-by: Yoshihiro YUNOMAE <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Gleb Natapov <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Hidehiro Kawai <[email protected]>
Cc: Sebastian Andrzej Siewior <[email protected]>
Cc: Zhang Yanfei <[email protected]>
Cc: Eric W. Biederman <[email protected]>
Cc: [email protected]
Cc: Masami Hiramatsu <[email protected]>
Cc: Seiji Aguchi <[email protected]>
Link: http://lkml.kernel.org/r/20130820070107.28245.83806.stgit@yunodevel
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions