diff options
author | Don Zickus <dzickus@redhat.com> | 2006-09-26 04:52:27 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:27 -0400 |
commit | 407984f1af259b31957c7c05075a454a751bb801 (patch) | |
tree | 1e9318b4255957c27a4dbacd84711604bf789393 /arch/i386 | |
parent | 2fbe7b25c8edaf2d10e6c1a4cc9f8afe714c4764 (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/i386')
-rw-r--r-- | arch/i386/kernel/nmi.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c index acd3fdea2a21..28065d0b71a9 100644 --- a/arch/i386/kernel/nmi.c +++ b/arch/i386/kernel/nmi.c | |||
@@ -846,6 +846,58 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | 848 | ||
849 | /* | ||
850 | * proc handler for /proc/sys/kernel/nmi_watchdog | ||
851 | */ | ||
852 | int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file, | ||
853 | void __user *buffer, size_t *length, loff_t *ppos) | ||
854 | { | ||
855 | int old_state; | ||
856 | |||
857 | nmi_watchdog_enabled = (atomic_read(&nmi_active) > 0) ? 1 : 0; | ||
858 | old_state = nmi_watchdog_enabled; | ||
859 | proc_dointvec(table, write, file, buffer, length, ppos); | ||
860 | if (!!old_state == !!nmi_watchdog_enabled) | ||
861 | return 0; | ||
862 | |||
863 | if (atomic_read(&nmi_active) < 0) { | ||
864 | printk(KERN_WARNING "NMI watchdog is permanently disabled\n"); | ||
865 | return -EINVAL; | ||
866 | } | ||
867 | |||
868 | if (nmi_watchdog == NMI_DEFAULT) { | ||
869 | if (nmi_known_cpu() > 0) | ||
870 | nmi_watchdog = NMI_LOCAL_APIC; | ||
871 | else | ||
872 | nmi_watchdog = NMI_IO_APIC; | ||
873 | } | ||
874 | |||
875 | if (nmi_watchdog == NMI_LOCAL_APIC) | ||
876 | { | ||
877 | if (nmi_watchdog_enabled) | ||
878 | enable_lapic_nmi_watchdog(); | ||
879 | else | ||
880 | disable_lapic_nmi_watchdog(); | ||
881 | } else if (nmi_watchdog == NMI_IO_APIC) { | ||
882 | /* FIXME | ||
883 | * for some reason these functions don't work | ||
884 | */ | ||
885 | printk("Can not enable/disable NMI on IO APIC\n"); | ||
886 | return -EINVAL; | ||
887 | #if 0 | ||
888 | if (nmi_watchdog_enabled) | ||
889 | enable_timer_nmi_watchdog(); | ||
890 | else | ||
891 | disable_timer_nmi_watchdog(); | ||
892 | #endif | ||
893 | } else { | ||
894 | printk( KERN_WARNING | ||
895 | "NMI watchdog doesn't know what hardware to touch\n"); | ||
896 | return -EIO; | ||
897 | } | ||
898 | return 0; | ||
899 | } | ||
900 | |||
849 | #endif | 901 | #endif |
850 | 902 | ||
851 | EXPORT_SYMBOL(nmi_active); | 903 | EXPORT_SYMBOL(nmi_active); |