Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1042-2.6.25-xen-x86-consistent-nmi.patch
Parent Directory | Revision Log
Revision 609 -
(show annotations)
(download)
Fri May 23 17:35:37 2008 UTC (16 years, 4 months ago) by niro
File size: 10029 byte(s)
Fri May 23 17:35:37 2008 UTC (16 years, 4 months ago) by niro
File size: 10029 byte(s)
-using opensuse xen patchset, updated kernel configs
1 | From: jbeulich@novell.com |
2 | Subject: make i386 and x86 NMI code consistent, disable all APIC-related stuff |
3 | Patch-mainline: obsolete |
4 | References: 191115 |
5 | |
6 | Index: head-2008-03-06/arch/x86/kernel/cpu/Makefile |
7 | =================================================================== |
8 | --- head-2008-03-06.orig/arch/x86/kernel/cpu/Makefile 2008-03-05 16:14:58.000000000 +0100 |
9 | +++ head-2008-03-06/arch/x86/kernel/cpu/Makefile 2008-03-06 10:52:57.000000000 +0100 |
10 | @@ -18,4 +18,6 @@ obj-$(CONFIG_X86_MCE) += mcheck/ |
11 | obj-$(CONFIG_MTRR) += mtrr/ |
12 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ |
13 | |
14 | +ifneq ($(CONFIG_XEN),y) |
15 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o |
16 | +endif |
17 | Index: head-2008-03-06/arch/x86/kernel/nmi_32.c |
18 | =================================================================== |
19 | --- head-2008-03-06.orig/arch/x86/kernel/nmi_32.c 2008-03-05 16:14:58.000000000 +0100 |
20 | +++ head-2008-03-06/arch/x86/kernel/nmi_32.c 2008-03-06 10:52:57.000000000 +0100 |
21 | @@ -28,7 +28,10 @@ |
22 | |
23 | #include "mach_traps.h" |
24 | |
25 | -int unknown_nmi_panic; |
26 | +extern void die_nmi(struct pt_regs *, const char *msg); |
27 | + |
28 | +#ifndef CONFIG_XEN |
29 | + |
30 | int nmi_watchdog_enabled; |
31 | |
32 | static cpumask_t backtrace_mask = CPU_MASK_NONE; |
33 | @@ -315,8 +318,6 @@ void touch_nmi_watchdog(void) |
34 | } |
35 | EXPORT_SYMBOL(touch_nmi_watchdog); |
36 | |
37 | -extern void die_nmi(struct pt_regs *, const char *msg); |
38 | - |
39 | __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) |
40 | { |
41 | |
42 | @@ -388,8 +389,12 @@ __kprobes int nmi_watchdog_tick(struct p |
43 | return rc; |
44 | } |
45 | |
46 | +#endif /* CONFIG_XEN */ |
47 | + |
48 | #ifdef CONFIG_SYSCTL |
49 | |
50 | +int unknown_nmi_panic; |
51 | + |
52 | static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) |
53 | { |
54 | unsigned char reason = get_nmi_reason(); |
55 | @@ -400,6 +405,7 @@ static int unknown_nmi_panic_callback(st |
56 | return 0; |
57 | } |
58 | |
59 | +#ifndef CONFIG_XEN |
60 | /* |
61 | * proc handler for /proc/sys/kernel/nmi |
62 | */ |
63 | @@ -438,6 +444,7 @@ int proc_nmi_enabled(struct ctl_table *t |
64 | } |
65 | return 0; |
66 | } |
67 | +#endif |
68 | |
69 | #endif |
70 | |
71 | @@ -450,6 +457,7 @@ int do_nmi_callback(struct pt_regs *regs |
72 | return 0; |
73 | } |
74 | |
75 | +#ifndef CONFIG_XEN |
76 | void __trigger_all_cpu_backtrace(void) |
77 | { |
78 | int i; |
79 | @@ -465,3 +473,4 @@ void __trigger_all_cpu_backtrace(void) |
80 | |
81 | EXPORT_SYMBOL(nmi_active); |
82 | EXPORT_SYMBOL(nmi_watchdog); |
83 | +#endif |
84 | Index: head-2008-03-06/arch/x86/kernel/nmi_64.c |
85 | =================================================================== |
86 | --- head-2008-03-06.orig/arch/x86/kernel/nmi_64.c 2008-03-05 16:14:58.000000000 +0100 |
87 | +++ head-2008-03-06/arch/x86/kernel/nmi_64.c 2008-03-06 10:52:57.000000000 +0100 |
88 | @@ -26,10 +26,12 @@ |
89 | #include <asm/proto.h> |
90 | #include <asm/mce.h> |
91 | |
92 | -int unknown_nmi_panic; |
93 | -int nmi_watchdog_enabled; |
94 | int panic_on_unrecovered_nmi; |
95 | |
96 | +#ifndef CONFIG_XEN |
97 | + |
98 | +int nmi_watchdog_enabled; |
99 | + |
100 | static cpumask_t backtrace_mask = CPU_MASK_NONE; |
101 | |
102 | /* nmi_active: |
103 | @@ -380,6 +382,8 @@ int __kprobes nmi_watchdog_tick(struct p |
104 | return rc; |
105 | } |
106 | |
107 | +#endif /* CONFIG_XEN */ |
108 | + |
109 | static unsigned ignore_nmis; |
110 | |
111 | asmlinkage __kprobes void do_nmi(struct pt_regs * regs, long error_code) |
112 | @@ -405,6 +409,8 @@ void restart_nmi(void) |
113 | |
114 | #ifdef CONFIG_SYSCTL |
115 | |
116 | +int unknown_nmi_panic; |
117 | + |
118 | static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu) |
119 | { |
120 | unsigned char reason = get_nmi_reason(); |
121 | @@ -415,6 +421,7 @@ static int unknown_nmi_panic_callback(st |
122 | return 0; |
123 | } |
124 | |
125 | +#ifndef CONFIG_XEN |
126 | /* |
127 | * proc handler for /proc/sys/kernel/nmi |
128 | */ |
129 | @@ -449,6 +456,7 @@ int proc_nmi_enabled(struct ctl_table *t |
130 | } |
131 | return 0; |
132 | } |
133 | +#endif |
134 | |
135 | #endif |
136 | |
137 | @@ -461,6 +469,7 @@ int do_nmi_callback(struct pt_regs *regs |
138 | return 0; |
139 | } |
140 | |
141 | +#ifndef CONFIG_XEN |
142 | void __trigger_all_cpu_backtrace(void) |
143 | { |
144 | int i; |
145 | @@ -476,3 +485,4 @@ void __trigger_all_cpu_backtrace(void) |
146 | |
147 | EXPORT_SYMBOL(nmi_active); |
148 | EXPORT_SYMBOL(nmi_watchdog); |
149 | +#endif |
150 | Index: head-2008-03-06/arch/x86/kernel/traps_32-xen.c |
151 | =================================================================== |
152 | --- head-2008-03-06.orig/arch/x86/kernel/traps_32-xen.c 2008-03-06 10:52:48.000000000 +0100 |
153 | +++ head-2008-03-06/arch/x86/kernel/traps_32-xen.c 2008-03-06 10:52:57.000000000 +0100 |
154 | @@ -806,12 +806,14 @@ static __kprobes void default_do_nmi(str |
155 | == NOTIFY_STOP) |
156 | return; |
157 | #ifdef CONFIG_X86_LOCAL_APIC |
158 | +#ifndef CONFIG_XEN |
159 | /* |
160 | * Ok, so this is none of the documented NMI sources, |
161 | * so it must be the NMI watchdog. |
162 | */ |
163 | if (nmi_watchdog_tick(regs, reason)) |
164 | return; |
165 | +#endif |
166 | if (!do_nmi_callback(regs, smp_processor_id())) |
167 | #endif |
168 | unknown_nmi_error(reason, regs); |
169 | Index: head-2008-03-06/arch/x86/kernel/traps_64-xen.c |
170 | =================================================================== |
171 | --- head-2008-03-06.orig/arch/x86/kernel/traps_64-xen.c 2008-03-06 10:52:39.000000000 +0100 |
172 | +++ head-2008-03-06/arch/x86/kernel/traps_64-xen.c 2008-03-06 10:52:57.000000000 +0100 |
173 | @@ -895,7 +895,7 @@ asmlinkage __kprobes void default_do_nmi |
174 | if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) |
175 | == NOTIFY_STOP) |
176 | return; |
177 | -#ifdef CONFIG_X86_LOCAL_APIC |
178 | +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) |
179 | /* |
180 | * Ok, so this is none of the documented NMI sources, |
181 | * so it must be the NMI watchdog. |
182 | Index: head-2008-03-06/include/asm-x86/irq_32.h |
183 | =================================================================== |
184 | --- head-2008-03-06.orig/include/asm-x86/irq_32.h 2008-01-24 23:58:37.000000000 +0100 |
185 | +++ head-2008-03-06/include/asm-x86/irq_32.h 2008-03-06 10:52:57.000000000 +0100 |
186 | @@ -20,7 +20,7 @@ static __inline__ int irq_canonicalize(i |
187 | return ((irq == 2) ? 9 : irq); |
188 | } |
189 | |
190 | -#ifdef CONFIG_X86_LOCAL_APIC |
191 | +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_XEN) |
192 | # define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ |
193 | #endif |
194 | |
195 | Index: head-2008-03-06/include/asm-x86/nmi_32.h |
196 | =================================================================== |
197 | --- head-2008-03-06.orig/include/asm-x86/nmi_32.h 2008-03-05 16:14:58.000000000 +0100 |
198 | +++ head-2008-03-06/include/asm-x86/nmi_32.h 2008-03-06 10:52:57.000000000 +0100 |
199 | @@ -4,8 +4,6 @@ |
200 | #include <linux/pm.h> |
201 | #include <asm/irq.h> |
202 | |
203 | -#ifdef ARCH_HAS_NMI_WATCHDOG |
204 | - |
205 | /** |
206 | * do_nmi_callback |
207 | * |
208 | @@ -14,6 +12,8 @@ |
209 | */ |
210 | int do_nmi_callback(struct pt_regs *regs, int cpu); |
211 | |
212 | +#ifdef ARCH_HAS_NMI_WATCHDOG |
213 | + |
214 | extern int nmi_watchdog_enabled; |
215 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); |
216 | extern int avail_to_resrv_perfctr_nmi(unsigned int); |
217 | @@ -41,13 +41,10 @@ struct ctl_table; |
218 | struct file; |
219 | extern int proc_nmi_enabled(struct ctl_table *, int , struct file *, |
220 | void __user *, size_t *, loff_t *); |
221 | -extern int unknown_nmi_panic; |
222 | |
223 | void __trigger_all_cpu_backtrace(void); |
224 | #define trigger_all_cpu_backtrace() __trigger_all_cpu_backtrace() |
225 | |
226 | -#endif |
227 | - |
228 | void lapic_watchdog_stop(void); |
229 | int lapic_watchdog_init(unsigned nmi_hz); |
230 | int lapic_wd_event(unsigned nmi_hz); |
231 | @@ -55,7 +52,12 @@ unsigned lapic_adjust_nmi_hz(unsigned hz |
232 | int lapic_watchdog_ok(void); |
233 | void disable_lapic_nmi_watchdog(void); |
234 | void enable_lapic_nmi_watchdog(void); |
235 | + |
236 | +#endif |
237 | + |
238 | void stop_nmi(void); |
239 | void restart_nmi(void); |
240 | |
241 | +extern int unknown_nmi_panic; |
242 | + |
243 | #endif /* ASM_NMI_H */ |
244 | Index: head-2008-03-06/include/asm-x86/nmi_64.h |
245 | =================================================================== |
246 | --- head-2008-03-06.orig/include/asm-x86/nmi_64.h 2008-03-05 16:14:58.000000000 +0100 |
247 | +++ head-2008-03-06/include/asm-x86/nmi_64.h 2008-03-06 10:52:57.000000000 +0100 |
248 | @@ -39,6 +39,9 @@ extern void die_nmi(char *str, struct pt |
249 | #define get_nmi_reason() inb(0x61) |
250 | |
251 | extern int unknown_nmi_panic; |
252 | + |
253 | +#ifndef CONFIG_XEN |
254 | + |
255 | extern int nmi_watchdog_enabled; |
256 | |
257 | extern int check_nmi_watchdog(void); |
258 | @@ -84,6 +87,9 @@ unsigned lapic_adjust_nmi_hz(unsigned hz |
259 | int lapic_watchdog_ok(void); |
260 | void disable_lapic_nmi_watchdog(void); |
261 | void enable_lapic_nmi_watchdog(void); |
262 | + |
263 | +#endif |
264 | + |
265 | void stop_nmi(void); |
266 | void restart_nmi(void); |
267 | |
268 | Index: head-2008-03-06/include/asm-x86/mach-xen/asm/irq_64.h |
269 | =================================================================== |
270 | --- head-2008-03-06.orig/include/asm-x86/mach-xen/asm/irq_64.h 2007-06-12 13:14:13.000000000 +0200 |
271 | +++ head-2008-03-06/include/asm-x86/mach-xen/asm/irq_64.h 2008-03-06 10:52:57.000000000 +0100 |
272 | @@ -20,7 +20,7 @@ static __inline__ int irq_canonicalize(i |
273 | return ((irq == 2) ? 9 : irq); |
274 | } |
275 | |
276 | -#ifdef CONFIG_X86_LOCAL_APIC |
277 | +#ifndef CONFIG_XEN |
278 | #define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ |
279 | #endif |
280 | |
281 | Index: head-2008-03-06/include/asm-x86/mach-xen/setup_arch_post.h |
282 | =================================================================== |
283 | --- head-2008-03-06.orig/include/asm-x86/mach-xen/setup_arch_post.h 2007-06-12 13:14:13.000000000 +0200 |
284 | +++ head-2008-03-06/include/asm-x86/mach-xen/setup_arch_post.h 2008-03-06 10:52:57.000000000 +0100 |
285 | @@ -27,12 +27,10 @@ static void __init machine_specific_arch |
286 | .type = CALLBACKTYPE_syscall, |
287 | .address = (unsigned long)system_call, |
288 | }; |
289 | -#ifdef CONFIG_X86_LOCAL_APIC |
290 | static struct callback_register __initdata nmi_cb = { |
291 | .type = CALLBACKTYPE_nmi, |
292 | .address = (unsigned long)nmi, |
293 | }; |
294 | -#endif |
295 | |
296 | ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event); |
297 | if (ret == 0) |
298 | @@ -48,7 +46,6 @@ static void __init machine_specific_arch |
299 | #endif |
300 | BUG_ON(ret); |
301 | |
302 | -#ifdef CONFIG_X86_LOCAL_APIC |
303 | ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb); |
304 | #if CONFIG_XEN_COMPAT <= 0x030002 |
305 | if (ret == -ENOSYS) { |
306 | @@ -59,5 +56,4 @@ static void __init machine_specific_arch |
307 | HYPERVISOR_nmi_op(XENNMI_register_callback, &cb); |
308 | } |
309 | #endif |
310 | -#endif |
311 | } |
312 | Index: head-2008-03-06/kernel/sysctl.c |
313 | =================================================================== |
314 | --- head-2008-03-06.orig/kernel/sysctl.c 2008-03-06 09:51:06.000000000 +0100 |
315 | +++ head-2008-03-06/kernel/sysctl.c 2008-03-06 10:52:57.000000000 +0100 |
316 | @@ -672,6 +672,7 @@ static struct ctl_table kern_table[] = { |
317 | .mode = 0644, |
318 | .proc_handler = &proc_dointvec, |
319 | }, |
320 | +#ifndef CONFIG_XEN |
321 | { |
322 | .procname = "nmi_watchdog", |
323 | .data = &nmi_watchdog_enabled, |
324 | @@ -680,6 +681,7 @@ static struct ctl_table kern_table[] = { |
325 | .proc_handler = &proc_nmi_enabled, |
326 | }, |
327 | #endif |
328 | +#endif |
329 | #if defined(CONFIG_X86) |
330 | { |
331 | .ctl_name = KERN_PANIC_ON_NMI, |