x86: call check_nmi_watchdog explicitly in native_smp_cpus_done
[sfrench/cifs-2.6.git] / arch / x86 / kernel / nmi_32.c
index 852db290692186d3f2697e6982a1d77494e708be..9cfc094eddb0cea59c2adcb9fc66f5662e054e66 100644 (file)
@@ -46,18 +46,15 @@ static unsigned int nmi_hz = HZ;
 
 static DEFINE_PER_CPU(short, wd_enabled);
 
-/* local prototypes */
-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,10 +64,10 @@ 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)
+int __init check_nmi_watchdog(void)
 {
        unsigned int *prev_nmi_count;
        int cpu;
@@ -87,11 +84,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
 
@@ -130,8 +129,6 @@ static int __init check_nmi_watchdog(void)
        kfree(prev_nmi_count);
        return 0;
 }
-/* This needs to happen later in boot so counters are working */
-late_initcall(check_nmi_watchdog);
 
 static int __init setup_nmi_watchdog(char *str)
 {
@@ -176,7 +173,7 @@ static int lapic_nmi_resume(struct sys_device *dev)
 
 
 static struct sysdev_class nmi_sysclass = {
-       set_kset_name("lapic_nmi"),
+       .name           = "lapic_nmi",
        .resume         = lapic_nmi_resume,
        .suspend        = lapic_nmi_suspend,
 };
@@ -237,10 +234,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 */
@@ -329,7 +326,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)
@@ -389,15 +386,6 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
        return rc;
 }
 
-int do_nmi_callback(struct pt_regs * regs, int cpu)
-{
-#ifdef CONFIG_SYSCTL
-       if (unknown_nmi_panic)
-               return unknown_nmi_panic_callback(regs, cpu);
-#endif
-       return 0;
-}
-
 #ifdef CONFIG_SYSCTL
 
 static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
@@ -451,6 +439,15 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 
 #endif
 
+int do_nmi_callback(struct pt_regs *regs, int cpu)
+{
+#ifdef CONFIG_SYSCTL
+       if (unknown_nmi_panic)
+               return unknown_nmi_panic_callback(regs, cpu);
+#endif
+       return 0;
+}
+
 void __trigger_all_cpu_backtrace(void)
 {
        int i;