x86: clean up nmi_32/64.c
PATCH 1/1 x86: clean up nmi_32/64.c
Subject: [PATCH] x86: clean up nmi_32/64.c
clean up and make nmi_32/64.c more similar.
- white space and coding style clean up.
- nmi_cpu_busy is available on CONFIG_SMP.
- move functions __acpi_nmi_enable, acpi_nmi_enable, __acpi_nmi_disable and acpi_nmi_disable.
- make variables name more similar.
Signed-off-by Hiroshi Shimamoto <[email protected]>
--- arch/x86/kernel/nmi_32.c | 18 +++++---- arch/x86/kernel/nmi_64.c | 92 +++++++++++++++++++++++----------------------- 2 files changed, 56 insertions(+), 54 deletions(-)
arch/x86/kernel/nmi_32.c +10 -8
@@ -51,13 +51,13 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu);static int endflag__initdata =0 ; +#ifdef CONFIG_SMP /* The performance counters used by NMI_LOCAL_APIC don't trigger when * the CPU is idle. To make sure the NMI watchdog really ticks on all * CPUs during the test make them busy. */ static __init void nmi_cpu_busy (void *data) { -#ifdef CONFIG_SMP local_irq_enable_in_hardirq ();/* Intentionally don't use cpu_relax here. This is to make sure that the performance counter really ticks,
@@ -67,8 +67,8 @@ static __init void nmi_cpu_busy(void *data)care if they get somewhat less cycles. */ while (endflag ==0 ) mb(); -#endif } +#endif static int __init check_nmi_watchdog (void ) {
@@ -87,11 +87,13 @@ static int __init check_nmi_watchdog(void)printk (KERN_INFO "Testing NMI watchdog ... " ); +#ifdef CONFIG_SMP if (nmi_watchdog ==NMI_LOCAL_APIC )smp_call_function (nmi_cpu_busy, (void *)&endflag,0 ,0 ); +#endif for_each_possible_cpu (cpu) - prev_nmi_count[cpu] =per_cpu (irq_stat, cpu).__nmi_count; + prev_nmi_count[cpu] =nmi_count (cpu);local_irq_enable ();mdelay ((20 *1000 )/nmi_hz);// wait 20 ticks
@@ -113,12 +115,13 @@ static int __init check_nmi_watchdog(void)atomic_dec (&nmi_active); } } - endflag =1 ;if (!atomic_read (&nmi_active)) {kfree (prev_nmi_count);atomic_set (&nmi_active,-1 ); + endflag =1 ;return -1 ; } + endflag =1 ;printk ("OK.\n" );/* now that we know it works we can reduce NMI frequency to
@@ -173,7 +176,6 @@ static int lapic_nmi_resume(struct sys_device *dev)return 0 ; } -static struct sysdev_class nmi_sysclass = {set_kset_name ("lapic_nmi" ), .resume = lapic_nmi_resume,
@@ -236,10 +238,10 @@ void acpi_nmi_disable(void)on_each_cpu (__acpi_nmi_disable,NULL ,0 ,1 ); } -void setup_apic_nmi_watchdog (void *unused) +void setup_apic_nmi_watchdog (void *unused) {if (__get_cpu_var (wd_enabled)) -return ; +return ;/* cheap hack to support suspend/resume */ /* if cpu0 is not active neither should the other cpus */
@@ -328,7 +330,7 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)unsigned int sum;int touched =0 ;int cpu =smp_processor_id (); -int rc=0 ; +int rc =0 ;/* check for other users first */ if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
arch/x86/kernel/nmi_64.c +46 -46
168 lines not on this page · raw message
Signature · 1 line
1.5.3.4