Commit 5dc3055879b8f659f62abb7c3d1eaa4d02e36d65
Committed by
Ingo Molnar
1 parent
96a84c20d6
Exists in
master
and in
4 other branches
x86, NMI: Add back unknown_nmi_panic and nmi_watchdog sysctls
Originally adapted from Huang Ying's patch which moved the unknown_nmi_panic to the traps.c file. Because the old nmi watchdog was deleted before this change happened, the unknown_nmi_panic sysctl was lost. This re-adds it. Also, the nmi_watchdog sysctl was re-implemented and its documentation updated accordingly. Patch-inspired-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Don Zickus <dzickus@redhat.com> Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com> Acked-by: Yinghai Lu <yinghai@kernel.org> Cc: fweisbec@gmail.com LKML-Reference: <1291068437-5331-3-git-send-email-dzickus@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 6 changed files with 30 additions and 18 deletions Side-by-side Diff
Documentation/kernel-parameters.txt
... | ... | @@ -1579,20 +1579,12 @@ |
1579 | 1579 | |
1580 | 1580 | nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels |
1581 | 1581 | Format: [panic,][num] |
1582 | - Valid num: 0,1,2 | |
1582 | + Valid num: 0 | |
1583 | 1583 | 0 - turn nmi_watchdog off |
1584 | - 1 - use the IO-APIC timer for the NMI watchdog | |
1585 | - 2 - use the local APIC for the NMI watchdog using | |
1586 | - a performance counter. Note: This will use one | |
1587 | - performance counter and the local APIC's performance | |
1588 | - vector. | |
1589 | 1584 | When panic is specified, panic when an NMI watchdog |
1590 | 1585 | timeout occurs. |
1591 | 1586 | This is useful when you use a panic=... timeout and |
1592 | 1587 | need the box quickly up again. |
1593 | - Instead of 1 and 2 it is possible to use the following | |
1594 | - symbolic names: lapic and ioapic | |
1595 | - Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic | |
1596 | 1588 | |
1597 | 1589 | netpoll.carrier_timeout= |
1598 | 1590 | [NET] Specifies amount of time (in seconds) that |
arch/x86/kernel/apic/hw_nmi.c
arch/x86/kernel/traps.c
... | ... | @@ -83,6 +83,8 @@ |
83 | 83 | |
84 | 84 | static int ignore_nmis; |
85 | 85 | |
86 | +int unknown_nmi_panic; | |
87 | + | |
86 | 88 | static inline void conditional_sti(struct pt_regs *regs) |
87 | 89 | { |
88 | 90 | if (regs->flags & X86_EFLAGS_IF) |
... | ... | @@ -300,6 +302,13 @@ |
300 | 302 | die("general protection fault", regs, error_code); |
301 | 303 | } |
302 | 304 | |
305 | +static int __init setup_unknown_nmi_panic(char *str) | |
306 | +{ | |
307 | + unknown_nmi_panic = 1; | |
308 | + return 1; | |
309 | +} | |
310 | +__setup("unknown_nmi_panic", setup_unknown_nmi_panic); | |
311 | + | |
303 | 312 | static notrace __kprobes void |
304 | 313 | mem_parity_error(unsigned char reason, struct pt_regs *regs) |
305 | 314 | { |
... | ... | @@ -371,7 +380,7 @@ |
371 | 380 | reason, smp_processor_id()); |
372 | 381 | |
373 | 382 | printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n"); |
374 | - if (panic_on_unrecovered_nmi) | |
383 | + if (unknown_nmi_panic || panic_on_unrecovered_nmi) | |
375 | 384 | panic("NMI: Not continuing"); |
376 | 385 | |
377 | 386 | printk(KERN_EMERG "Dazed and confused, but trying to continue\n"); |
378 | 387 | |
... | ... | @@ -397,11 +406,8 @@ |
397 | 406 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) |
398 | 407 | == NOTIFY_STOP) |
399 | 408 | return; |
400 | - | |
401 | - unknown_nmi_error(reason, regs); | |
402 | -#else | |
403 | - unknown_nmi_error(reason, regs); | |
404 | 409 | #endif |
410 | + unknown_nmi_error(reason, regs); | |
405 | 411 | |
406 | 412 | return; |
407 | 413 | } |
kernel/sysctl.c
... | ... | @@ -745,6 +745,22 @@ |
745 | 745 | .extra1 = &zero, |
746 | 746 | .extra2 = &one, |
747 | 747 | }, |
748 | + { | |
749 | + .procname = "nmi_watchdog", | |
750 | + .data = &watchdog_enabled, | |
751 | + .maxlen = sizeof (int), | |
752 | + .mode = 0644, | |
753 | + .proc_handler = proc_dowatchdog_enabled, | |
754 | + }, | |
755 | +#endif | |
756 | +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) | |
757 | + { | |
758 | + .procname = "unknown_nmi_panic", | |
759 | + .data = &unknown_nmi_panic, | |
760 | + .maxlen = sizeof (int), | |
761 | + .mode = 0644, | |
762 | + .proc_handler = proc_dointvec, | |
763 | + }, | |
748 | 764 | #endif |
749 | 765 | #if defined(CONFIG_X86) |
750 | 766 | { |
kernel/sysctl_binary.c
... | ... | @@ -136,7 +136,6 @@ |
136 | 136 | { CTL_INT, KERN_IA64_UNALIGNED, "ignore-unaligned-usertrap" }, |
137 | 137 | { CTL_INT, KERN_COMPAT_LOG, "compat-log" }, |
138 | 138 | { CTL_INT, KERN_MAX_LOCK_DEPTH, "max_lock_depth" }, |
139 | - { CTL_INT, KERN_NMI_WATCHDOG, "nmi_watchdog" }, | |
140 | 139 | { CTL_INT, KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" }, |
141 | 140 | {} |
142 | 141 | }; |