aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorDon Zickus <dzickus@redhat.com>2006-09-26 04:52:27 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:27 -0400
commit407984f1af259b31957c7c05075a454a751bb801 (patch)
tree1e9318b4255957c27a4dbacd84711604bf789393 /arch/x86_64
parent2fbe7b25c8edaf2d10e6c1a4cc9f8afe714c4764 (diff)
[PATCH] x86: Add abilty to enable/disable nmi watchdog with sysctl
Adds a new /proc/sys/kernel/nmi call that will enable/disable the nmi watchdog. Signed-off-by: Don Zickus <dzickus@redhat.com> Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/nmi.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 9d175dcf3a2d..3a17411a9a19 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -750,6 +750,54 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
750 return 0; 750 return 0;
751} 751}
752 752
753/*
754 * proc handler for /proc/sys/kernel/nmi
755 */
756int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
757 void __user *buffer, size_t *length, loff_t *ppos)
758{
759 int old_state;
760
761 nmi_watchdog_enabled = (atomic_read(&nmi_active) > 0) ? 1 : 0;
762 old_state = nmi_watchdog_enabled;
763 proc_dointvec(table, write, file, buffer, length, ppos);
764 if (!!old_state == !!nmi_watchdog_enabled)
765 return 0;
766
767 if (atomic_read(&nmi_active) < 0) {
768 printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
769 return -EINVAL;
770 }
771
772 /* if nmi_watchdog is not set yet, then set it */
773 nmi_watchdog_default();
774
775 if (nmi_watchdog == NMI_LOCAL_APIC)
776 {
777 if (nmi_watchdog_enabled)
778 enable_lapic_nmi_watchdog();
779 else
780 disable_lapic_nmi_watchdog();
781 } else if (nmi_watchdog == NMI_IO_APIC) {
782 /* FIXME
783 * for some reason these functions don't work
784 */
785 printk("Can not enable/disable NMI on IO APIC\n");
786 return -EIO;
787#if 0
788 if (nmi_watchdog_enabled)
789 enable_timer_nmi_watchdog();
790 else
791 disable_timer_nmi_watchdog();
792#endif
793 } else {
794 printk(KERN_WARNING
795 "NMI watchdog doesn't know what hardware to touch\n");
796 return -EIO;
797 }
798 return 0;
799}
800
753#endif 801#endif
754 802
755EXPORT_SYMBOL(nmi_active); 803EXPORT_SYMBOL(nmi_active);