Forráskód Böngészése

x86: nmi_32.c - add nmi_watchdog_default helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: hpa@zytor.com
Cc: mingo@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cyrill Gorcunov 17 éve
szülő
commit
4b82b27770
2 módosított fájl, 14 hozzáadás és 9 törlés
  1. 13 6
      arch/x86/kernel/nmi_32.c
  2. 1 3
      include/asm-x86/nmi.h

+ 13 - 6
arch/x86/kernel/nmi_32.c

@@ -51,6 +51,17 @@ static DEFINE_PER_CPU(short, wd_enabled);
 
 
 static int endflag __initdata = 0;
 static int endflag __initdata = 0;
 
 
+/* Run after command line and cpu_init init, but before all other checks */
+void nmi_watchdog_default(void)
+{
+	if (nmi_watchdog != NMI_DEFAULT)
+		return;
+	if (lapic_watchdog_ok())
+		nmi_watchdog = NMI_LOCAL_APIC;
+	else
+		nmi_watchdog = NMI_IO_APIC;
+}
+
 #ifdef CONFIG_SMP
 #ifdef CONFIG_SMP
 /* The performance counters used by NMI_LOCAL_APIC don't trigger when
 /* 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
  * the CPU is idle. To make sure the NMI watchdog really ticks on all
@@ -437,12 +448,8 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
 		return -EIO;
 		return -EIO;
 	}
 	}
 
 
-	if (nmi_watchdog == NMI_DEFAULT) {
-		if (lapic_watchdog_ok())
-			nmi_watchdog = NMI_LOCAL_APIC;
-		else
-			nmi_watchdog = NMI_IO_APIC;
-	}
+	/* if nmi_watchdog is not set yet, then set it */
+	nmi_watchdog_default();
 
 
 	if (nmi_watchdog == NMI_LOCAL_APIC) {
 	if (nmi_watchdog == NMI_LOCAL_APIC) {
 		if (nmi_watchdog_enabled)
 		if (nmi_watchdog_enabled)

+ 1 - 3
include/asm-x86/nmi.h

@@ -38,11 +38,9 @@ static inline void unset_nmi_pm_callback(struct pm_dev *dev)
 
 
 #ifdef CONFIG_X86_64
 #ifdef CONFIG_X86_64
 extern void default_do_nmi(struct pt_regs *);
 extern void default_do_nmi(struct pt_regs *);
-extern void nmi_watchdog_default(void);
-#else
-#define nmi_watchdog_default() do {} while (0)
 #endif
 #endif
 
 
+extern void nmi_watchdog_default(void);
 extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
 extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
 extern int check_nmi_watchdog(void);
 extern int check_nmi_watchdog(void);
 extern int nmi_watchdog_enabled;
 extern int nmi_watchdog_enabled;