Re: [patch 8/8] Add abilty to enable/disable nmi watchdog from sysfs

From: Andi Kleen
Date: Tue May 09 2006 - 17:41:26 EST


On Tuesday 09 May 2006 22:50, dzickus wrote:
>
> Adds a new /proc/sys/kernel/nmi call that will enable/disable the nmi
> watchdog.

The subject is wrong i think - sysctl != sysfs.

And shouldn't that be called nmi_watchdog?

>
> Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
>
> Index: linux-don/arch/i386/kernel/nmi.c
> ===================================================================
> --- linux-don.orig/arch/i386/kernel/nmi.c
> +++ linux-don/arch/i386/kernel/nmi.c
> @@ -845,6 +845,56 @@ static int unknown_nmi_panic_callback(st
> return 0;
> }
>
> +/*
> + * proc handler for /proc/sys/kernel/nmi
> + */
> +int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
> + void __user *buffer, size_t *length, loff_t *ppos)
> +{
> + int old_state;
> +
> + nmi_watchdog_enabled = (atomic_read(&nmi_active) > 0) ? 1 : 0;
> + old_state = nmi_watchdog_enabled;
> + proc_dointvec(table, write, file, buffer, length, ppos);
> + if (!!old_state == !!nmi_watchdog_enabled)
> + return 0;
> +
> + if (atomic_read(&nmi_active) < 0) {
> + printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
> + return 0;
> + }

The returns should be probably -EIO or similar. Same further down.

> +
> + if (nmi_watchdog == NMI_DEFAULT) {
> + if (nmi_known_cpu() > 0)
> + nmi_watchdog = NMI_LOCAL_APIC;
> + else
> + nmi_watchdog = NMI_IO_APIC;
> + }
> +
> + if (nmi_watchdog == NMI_LOCAL_APIC)
> + {

Move the { up

Anyways I fixed these up myself, no need to resubmit.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/