Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > d41cc2729f5f0fbbd2607b14a49457f3 > files > 53

kernel-xen-2.6.32.11-2mdv2010.1.src.rpm

From: jbeulich@novell.com
Subject: make i386 and x86 NMI code consistent, disable all APIC-related stuff
Patch-mainline: obsolete
References: 191115

--- sle11sp1-2010-02-09.orig/arch/x86/include/asm/irq.h	2010-02-09 16:33:59.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/include/asm/irq.h	2009-10-13 17:07:27.000000000 +0200
@@ -15,7 +15,7 @@ static inline int irq_canonicalize(int i
 	return ((irq == 2) ? 9 : irq);
 }
 
-#ifdef CONFIG_X86_LOCAL_APIC
+#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN)
 # define ARCH_HAS_NMI_WATCHDOG
 #endif
 
--- sle11sp1-2010-02-09.orig/arch/x86/include/asm/nmi.h	2010-02-09 16:33:59.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/include/asm/nmi.h	2009-10-13 17:07:27.000000000 +0200
@@ -5,8 +5,6 @@
 #include <asm/irq.h>
 #include <asm/io.h>
 
-#ifdef ARCH_HAS_NMI_WATCHDOG
-
 /**
  * do_nmi_callback
  *
@@ -16,6 +14,11 @@
 int do_nmi_callback(struct pt_regs *regs, int cpu);
 
 extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
+
+extern int unknown_nmi_panic;
+
+#ifdef ARCH_HAS_NMI_WATCHDOG
+
 extern int check_nmi_watchdog(void);
 extern int nmi_watchdog_enabled;
 extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
@@ -42,7 +45,6 @@ extern unsigned int nmi_watchdog;
 struct ctl_table;
 extern int proc_nmi_enabled(struct ctl_table *, int ,
 			void __user *, size_t *, loff_t *);
-extern int unknown_nmi_panic;
 
 void arch_trigger_all_cpu_backtrace(void);
 #define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
@@ -65,7 +67,6 @@ static inline int nmi_watchdog_active(vo
 	 */
 	return nmi_watchdog & (NMI_LOCAL_APIC | NMI_IO_APIC);
 }
-#endif
 
 void lapic_watchdog_stop(void);
 int lapic_watchdog_init(unsigned nmi_hz);
@@ -73,6 +74,9 @@ int lapic_wd_event(unsigned nmi_hz);
 unsigned lapic_adjust_nmi_hz(unsigned hz);
 void disable_lapic_nmi_watchdog(void);
 void enable_lapic_nmi_watchdog(void);
+
+#endif
+
 void stop_nmi(void);
 void restart_nmi(void);
 
--- sle11sp1-2010-02-09.orig/arch/x86/kernel/apic/Makefile	2009-11-06 10:52:02.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/kernel/apic/Makefile	2009-10-13 17:07:27.000000000 +0200
@@ -18,8 +18,6 @@ obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
 obj-$(CONFIG_X86_ES7000)	+= es7000_32.o
 obj-$(CONFIG_X86_SUMMIT)	+= summit_32.o
 
-obj-$(CONFIG_XEN)		+= nmi.o
-
 probe_64-$(CONFIG_XEN)		:= probe_32.o
 
 disabled-obj-$(CONFIG_XEN)	:= apic_flat_$(BITS).o
--- sle11sp1-2010-02-09.orig/arch/x86/kernel/apic/nmi.c	2009-11-06 10:51:42.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/kernel/apic/nmi.c	2009-10-13 17:18:34.000000000 +0200
@@ -27,8 +27,10 @@
 #include <linux/kdebug.h>
 #include <linux/smp.h>
 
-#ifndef CONFIG_XEN
+#ifdef ARCH_HAS_NMI_WATCHDOG
 #include <asm/i8259.h>
+#else
+#include <asm/nmi.h>
 #endif
 #include <asm/io_apic.h>
 #include <asm/proto.h>
@@ -39,6 +41,9 @@
 #include <asm/mach_traps.h>
 
 int unknown_nmi_panic;
+
+#ifdef ARCH_HAS_NMI_WATCHDOG
+
 int nmi_watchdog_enabled;
 
 static cpumask_t backtrace_mask __read_mostly;
@@ -176,13 +181,11 @@ int __init check_nmi_watchdog(void)
 	kfree(prev_nmi_count);
 	return 0;
 error:
-#ifndef CONFIG_XEN
 	if (nmi_watchdog == NMI_IO_APIC) {
 		if (!timer_through_8259)
 			disable_8259A_irq(0);
 		on_each_cpu(__acpi_nmi_disable, NULL, 1);
 	}
-#endif
 
 #ifdef CONFIG_X86_32
 	timer_ack = 0;
@@ -472,8 +475,11 @@ nmi_watchdog_tick(struct pt_regs *regs, 
 	return rc;
 }
 
+#endif /* ARCH_HAS_NMI_WATCHDOG */
+
 #ifdef CONFIG_SYSCTL
 
+#ifdef ARCH_HAS_NMI_WATCHDOG
 static void enable_ioapic_nmi_watchdog_single(void *unused)
 {
 	__get_cpu_var(wd_enabled) = 1;
@@ -491,6 +497,7 @@ static void disable_ioapic_nmi_watchdog(
 {
 	on_each_cpu(stop_apic_nmi_watchdog, NULL, 1);
 }
+#endif
 
 static int __init setup_unknown_nmi_panic(char *str)
 {
@@ -509,6 +516,7 @@ static int unknown_nmi_panic_callback(st
 	return 0;
 }
 
+#ifdef ARCH_HAS_NMI_WATCHDOG
 /*
  * proc handler for /proc/sys/kernel/nmi
  */
@@ -546,6 +554,7 @@ int proc_nmi_enabled(struct ctl_table *t
 	}
 	return 0;
 }
+#endif
 
 #endif /* CONFIG_SYSCTL */
 
@@ -558,6 +567,7 @@ int do_nmi_callback(struct pt_regs *regs
 	return 0;
 }
 
+#ifdef ARCH_HAS_NMI_WATCHDOG
 void arch_trigger_all_cpu_backtrace(void)
 {
 	int i;
@@ -574,3 +584,4 @@ void arch_trigger_all_cpu_backtrace(void
 		mdelay(1);
 	}
 }
+#endif
--- sle11sp1-2010-02-09.orig/arch/x86/kernel/cpu/Makefile	2010-02-09 17:07:42.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/kernel/cpu/Makefile	2010-02-09 17:19:39.000000000 +0100
@@ -33,7 +33,7 @@ obj-$(CONFIG_CPU_FREQ)			+= cpufreq/
 
 obj-$(CONFIG_X86_LOCAL_APIC)		+= perfctr-watchdog.o
 
-disabled-obj-$(CONFIG_XEN) := hypervisor.o vmware.o sched.o
+disabled-obj-$(CONFIG_XEN) := hypervisor.o vmware.o sched.o perfctr-watchdog.o
 
 quiet_cmd_mkcapflags = MKCAP   $@
       cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
--- sle11sp1-2010-02-09.orig/arch/x86/kernel/head-xen.c	2009-11-06 10:52:22.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/kernel/head-xen.c	2009-10-15 15:32:46.000000000 +0200
@@ -179,12 +179,10 @@ void __init xen_arch_setup(void)
 		.address = CALLBACK_ADDR(system_call)
 	};
 #endif
-#if defined(CONFIG_X86_LOCAL_APIC) || defined(CONFIG_X86_32)
 	static const struct callback_register __initconst nmi_cb = {
 		.type = CALLBACKTYPE_nmi,
 		.address = CALLBACK_ADDR(nmi)
 	};
-#endif
 
 	ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
 	if (ret == 0)
@@ -208,7 +206,6 @@ void __init xen_arch_setup(void)
 #endif
 	BUG_ON(ret);
 
-#if defined(CONFIG_X86_LOCAL_APIC) || defined(CONFIG_X86_32)
 	ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
 #if CONFIG_XEN_COMPAT <= 0x030002
 	if (ret == -ENOSYS) {
@@ -219,6 +216,5 @@ void __init xen_arch_setup(void)
 		HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
 	}
 #endif
-#endif
 }
 #endif /* CONFIG_XEN */
--- sle11sp1-2010-02-09.orig/arch/x86/kernel/traps-xen.c	2009-11-06 10:52:23.000000000 +0100
+++ sle11sp1-2010-02-09/arch/x86/kernel/traps-xen.c	2009-10-14 17:26:48.000000000 +0200
@@ -51,6 +51,7 @@
 #include <asm/atomic.h>
 #include <asm/system.h>
 #include <asm/traps.h>
+#include <asm/nmi.h>
 #include <asm/desc.h>
 #include <asm/i387.h>
 #include <asm/mce.h>
@@ -394,12 +395,14 @@ static notrace __kprobes void default_do
 								== NOTIFY_STOP)
 			return;
 #ifdef CONFIG_X86_LOCAL_APIC
+#ifdef ARCH_HAS_NMI_WATCHDOG
 		/*
 		 * Ok, so this is none of the documented NMI sources,
 		 * so it must be the NMI watchdog.
 		 */
 		if (nmi_watchdog_tick(regs, reason))
 			return;
+#endif
 		if (!do_nmi_callback(regs, cpu))
 			unknown_nmi_error(reason, regs);
 #else
--- sle11sp1-2010-02-09.orig/kernel/sysctl.c	2009-12-16 11:47:57.000000000 +0100
+++ sle11sp1-2010-02-09/kernel/sysctl.c	2009-12-16 12:15:35.000000000 +0100
@@ -790,6 +790,7 @@ static struct ctl_table kern_table[] = {
 		.mode           = 0644,
 		.proc_handler   = &proc_dointvec,
 	},
+#ifdef ARCH_HAS_NMI_WATCHDOG
 	{
 		.procname       = "nmi_watchdog",
 		.data           = &nmi_watchdog_enabled,
@@ -798,6 +799,7 @@ static struct ctl_table kern_table[] = {
 		.proc_handler   = &proc_nmi_enabled,
 	},
 #endif
+#endif
 #if defined(CONFIG_X86)
 	{
 		.ctl_name	= KERN_PANIC_ON_NMI,