public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] x86: nmi - consolidate nmi_watchdog_default for 32bit mode
       [not found] <20080603184648.162308982@gmail.com>
@ 1970-01-01  0:00 ` Cyrill Gorcunov
  1970-01-01  0:00 ` [patch 2/2] x86: watchdog - check for CPU is being supported Cyrill Gorcunov
  1 sibling, 0 replies; 2+ messages in thread
From: Cyrill Gorcunov @ 1970-01-01  0:00 UTC (permalink / raw)
  To: tglx, mingo, hpa, macro; +Cc: linux-kernel, gorcunov

[-- Attachment #1: nmi-consolidate-nmi_watchdog_default --]
[-- Type: text/plain, Size: 2221 bytes --]

64bit mode bootstrap code does set nmi_watchdog to NMI_NONE
by default and doing the same on 32bit mode is safe too.
Such an action saves us from several #ifdef.

Btw, my previous commit

commit 19ec673ced067316b9732bc6d1c4ff4052e5f795
Author: Cyrill Gorcunov <gorcunov@gmail.com>
Date:   Wed May 28 23:00:47 2008 +0400

    x86: nmi - fix incorrect NMI watchdog used by default
    
did not fix the problem completely, moreover it
introduced additional bug - nmi_watchdog would be
set to either NMI_LOCAL_APIC or NMI_IO_APIC
_regardless_ to boot option if being enabled thru
/proc/sys/kernel/nmi_watchdog. Sorry for that.
Fix it too.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

Index: linux-2.6.git/arch/x86/kernel/nmi.c
====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/nmi.c	2008-06-02 18:03:13.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/nmi.c	2008-06-02 20:33:31.000000000 +0400
@@ -487,14 +487,16 @@ int proc_nmi_enabled(struct ctl_table *t
 		return -EIO;
 	}
 
-#ifdef CONFIG_X86_64
 	/* if nmi_watchdog is not set yet, then set it */
 	nmi_watchdog_default();
-#else
-	if (lapic_watchdog_ok())
-		nmi_watchdog = NMI_LOCAL_APIC;
-	else
-		nmi_watchdog = NMI_IO_APIC;
+
+#ifdef CONFIG_X86_32
+	if (nmi_watchdog == NMI_NONE) {
+		if (lapic_watchdog_ok())
+			nmi_watchdog = NMI_LOCAL_APIC;
+		else
+			nmi_watchdog = NMI_IO_APIC;
+	}
 #endif
 
 	if (nmi_watchdog == NMI_LOCAL_APIC) {
Index: linux-2.6.git/include/asm-x86/nmi.h
====================================================================
--- linux-2.6.git.orig/include/asm-x86/nmi.h	2008-06-02 18:03:14.000000000 +0400
+++ linux-2.6.git/include/asm-x86/nmi.h	2008-06-02 20:31:48.000000000 +0400
@@ -38,12 +38,10 @@ static inline void unset_nmi_pm_callback
 
 #ifdef CONFIG_X86_64
 extern void default_do_nmi(struct pt_regs *);
-extern void nmi_watchdog_default(void);
-#else
-#define nmi_watchdog_default() do { } while (0)
 #endif
 
 extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
+extern void nmi_watchdog_default(void);
 extern int check_nmi_watchdog(void);
 extern int nmi_watchdog_enabled;
 extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [patch 2/2] x86: watchdog - check for CPU is being supported
       [not found] <20080603184648.162308982@gmail.com>
  1970-01-01  0:00 ` [patch 1/2] x86: nmi - consolidate nmi_watchdog_default for 32bit mode Cyrill Gorcunov
@ 1970-01-01  0:00 ` Cyrill Gorcunov
  1 sibling, 0 replies; 2+ messages in thread
From: Cyrill Gorcunov @ 1970-01-01  0:00 UTC (permalink / raw)
  To: tglx, mingo, hpa, macro; +Cc: linux-kernel, gorcunov

[-- Attachment #1: nmi-watchdog-ureserve-check --]
[-- Type: text/plain, Size: 832 bytes --]

This patch does check if CPU is being recongnized
before call the unreserve(). Since enable_lapic_nmi_watchdog()
does have such a check the same is make sense here too
in a sake of code consistency (but nothing more).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

Index: linux-2.6.git/arch/x86/kernel/cpu/perfctr-watchdog.c
====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/cpu/perfctr-watchdog.c	2008-06-03 20:48:26.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/cpu/perfctr-watchdog.c	2008-06-03 21:26:00.000000000 +0400
@@ -181,7 +181,9 @@ void disable_lapic_nmi_watchdog(void)
 		return;
 
 	on_each_cpu(stop_apic_nmi_watchdog, NULL, 0, 1);
-	wd_ops->unreserve();
+
+	if (wd_ops)
+		wd_ops->unreserve();
 
 	BUG_ON(atomic_read(&nmi_active) != 0);
 }

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-03 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080603184648.162308982@gmail.com>
1970-01-01  0:00 ` [patch 1/2] x86: nmi - consolidate nmi_watchdog_default for 32bit mode Cyrill Gorcunov
1970-01-01  0:00 ` [patch 2/2] x86: watchdog - check for CPU is being supported Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox