[PATCH] i386/x86_64: NMI watchdog: Protect smp_call_function() within CONFIG_SMP and some trivialities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



a. arch/i386/kernel/nmi.c:check_nmi_watchdog() calls
  smp_call_function() unconditionally. Protect it inside
  a #ifdef CONFIG_SMP, as it is meaningless for UP, also
  making i386's version similar to x86_64's.
b. Also update the filename in the comment on top of
  arch/{i386, x86_64}/kernel/nmi.c, while we're editing
  these files.

BTW: smp_call_function() simply returns 0 and
smp_call_function_single() simply returns -EBUSY when !SMP.
These appear to be just some ad hoc values. IMHO, we should
be going BUG() in both these cases because "other" CPUs for
!SMP are undefined / meaningless. [ Copying Alan Cox. ]

Signed-off-by: Satyam Sharma <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Alan Cox <[email protected]>

---

arch/i386/kernel/nmi.c   |    4 +++-
arch/x86_64/kernel/nmi.c |    2 +-
2 files changed, 4 insertions(+), 2 deletions(-)

---

diff -ruNp a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
--- a/arch/i386/kernel/nmi.c	2007-06-07 12:46:34.000000000 +0530
+++ b/arch/i386/kernel/nmi.c	2007-06-07 15:43:52.000000000 +0530
@@ -1,5 +1,5 @@
/*
- *  linux/arch/i386/nmi.c
+ *  linux/arch/i386/kernel/nmi.c
 *
 *  NMI watchdog support on APIC systems
 *
@@ -89,8 +89,10 @@ static int __init check_nmi_watchdog(voi

	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;
diff -ruNp a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
--- a/arch/x86_64/kernel/nmi.c	2007-06-07 12:46:39.000000000 +0530
+++ b/arch/x86_64/kernel/nmi.c	2007-06-07 15:43:13.000000000 +0530
@@ -1,5 +1,5 @@
/*
- *  linux/arch/x86_64/nmi.c
+ *  linux/arch/x86_64/kernel/nmi.c
 *
 *  NMI watchdog support on APIC systems
 *
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux