qubes-linux-kernel/patches.xen/xen-x86-consistent-nmi
2010-07-07 13:12:45 +02:00

248 lines
7.0 KiB
Plaintext

From: jbeulich@novell.com
Subject: make i386 and x86 NMI code consistent, disable all APIC-related stuff
Patch-mainline: obsolete
References: 191115
--- head-2010-04-15.orig/arch/x86/include/asm/irq.h 2010-04-15 09:37:45.000000000 +0200
+++ head-2010-04-15/arch/x86/include/asm/irq.h 2010-03-25 14:40:02.000000000 +0100
@@ -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
--- head-2010-04-15.orig/arch/x86/include/asm/nmi.h 2010-04-15 09:37:45.000000000 +0200
+++ head-2010-04-15/arch/x86/include/asm/nmi.h 2010-03-25 14:40:02.000000000 +0100
@@ -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);
@@ -41,7 +44,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
@@ -64,7 +66,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);
@@ -72,6 +73,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);
--- head-2010-04-15.orig/arch/x86/kernel/apic/Makefile 2010-03-24 16:00:05.000000000 +0100
+++ head-2010-04-15/arch/x86/kernel/apic/Makefile 2010-03-25 14:40:02.000000000 +0100
@@ -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 apic_noop.o
--- head-2010-04-15.orig/arch/x86/kernel/apic/nmi.c 2010-04-15 10:05:32.000000000 +0200
+++ head-2010-04-15/arch/x86/kernel/apic/nmi.c 2010-04-15 11:46:23.000000000 +0200
@@ -28,8 +28,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>
@@ -40,6 +42,9 @@
#include <asm/mach_traps.h>
int unknown_nmi_panic;
+
+#ifdef ARCH_HAS_NMI_WATCHDOG
+
int nmi_watchdog_enabled;
/* For reliability, we're prepared to waste bits here. */
@@ -178,13 +183,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)
legacy_pic->chip->mask(0);
on_each_cpu(__acpi_nmi_disable, NULL, 1);
}
-#endif
#ifdef CONFIG_X86_32
timer_ack = 0;
@@ -474,8 +477,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;
@@ -493,6 +499,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)
{
@@ -511,6 +518,7 @@ static int unknown_nmi_panic_callback(st
return 0;
}
+#ifdef ARCH_HAS_NMI_WATCHDOG
/*
* proc handler for /proc/sys/kernel/nmi
*/
@@ -548,6 +556,7 @@ int proc_nmi_enabled(struct ctl_table *t
}
return 0;
}
+#endif
#endif /* CONFIG_SYSCTL */
@@ -560,6 +569,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;
@@ -576,3 +586,4 @@ void arch_trigger_all_cpu_backtrace(void
mdelay(1);
}
}
+#endif
--- head-2010-04-15.orig/arch/x86/kernel/cpu/Makefile 2010-03-24 16:00:05.000000000 +0100
+++ head-2010-04-15/arch/x86/kernel/cpu/Makefile 2010-03-25 14:40:02.000000000 +0100
@@ -34,7 +34,7 @@ obj-$(CONFIG_CPU_FREQ) += cpufreq/
obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
-disabled-obj-$(CONFIG_XEN) := hypervisor.o perf_event.o sched.o vmware.o
+disabled-obj-$(CONFIG_XEN) := hypervisor.o perfctr-watchdog.o perf_event.o sched.o vmware.o
quiet_cmd_mkcapflags = MKCAP $@
cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
--- head-2010-04-15.orig/arch/x86/kernel/head-xen.c 2010-04-15 10:13:18.000000000 +0200
+++ head-2010-04-15/arch/x86/kernel/head-xen.c 2010-04-15 11:46:18.000000000 +0200
@@ -183,12 +183,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)
@@ -212,7 +210,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) {
@@ -223,6 +220,5 @@ void __init xen_arch_setup(void)
HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
}
#endif
-#endif
}
#endif /* CONFIG_XEN */
--- head-2010-04-15.orig/arch/x86/kernel/traps-xen.c 2010-03-25 16:41:03.000000000 +0100
+++ head-2010-04-15/arch/x86/kernel/traps-xen.c 2010-03-25 14:40:02.000000000 +0100
@@ -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
--- head-2010-04-15.orig/kernel/sysctl.c 2010-03-24 14:53:41.000000000 +0100
+++ head-2010-04-15/kernel/sysctl.c 2010-03-25 14:40:02.000000000 +0100
@@ -699,6 +699,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,
@@ -707,6 +708,7 @@ static struct ctl_table kern_table[] = {
.proc_handler = proc_nmi_enabled,
},
#endif
+#endif
#if defined(CONFIG_X86)
{
.procname = "panic_on_unrecovered_nmi",