1 arch/i386/kernel/crash.c | 24 +++++++++++++++++-------
2 arch/i386/kernel/nmi.c | 2 +-
3 include/asm-i386/apic.h | 1 +
4 include/linux/crash.h | 2 +-
5 kernel/bootimg.c | 13 ++++++++++++-
6 kernel/bootimg_pic.c | 6 ++++--
7 6 files changed, 36 insertions(+), 12 deletions(-)
9 Index: linux-2.4.20-rh/kernel/bootimg.c
10 ===================================================================
11 --- linux-2.4.20-rh.orig/kernel/bootimg.c 2003-10-29 23:56:02.000000000 +0800
12 +++ linux-2.4.20-rh/kernel/bootimg.c 2003-10-29 23:56:17.000000000 +0800
16 if (bootimg_checksum(__va(bootimg_dsc.page_dir),bootimg_dsc.pages)
17 - != bootimg_dsc.csum)
18 + != bootimg_dsc.csum) {
19 printk("Checksum of kernel image failed. Rebooting via BIOS\n");
21 + /* Before calling machine_restart(), make sure it will not
22 + * simply call this function recursively.
24 + bootimg_dsc.page_dir = NULL;
25 + machine_restart(NULL);
27 + /* We should never get here, but just in case... */
29 + __asm__ __volatile__ ("hlt");
32 code_page = get_identity_mapped_page();
33 if (!code_page) goto out3;
34 code = (relocate_and_jump_t) virt_to_phys((void *) code_page);
35 Index: linux-2.4.20-rh/kernel/bootimg_pic.c
36 ===================================================================
37 --- linux-2.4.20-rh.orig/kernel/bootimg_pic.c 2003-10-29 23:56:02.000000000 +0800
38 +++ linux-2.4.20-rh/kernel/bootimg_pic.c 2003-10-29 23:56:17.000000000 +0800
40 for (j = i+1; j < dsc.pages; j++) {
41 table = dsc.page_dir+FROM_TABLE(j);
42 if (((unsigned long) *table) == to) {
43 - copy_and_swap(*table,dsc.scratch);
44 + copy_and_swap((unsigned long) (*table),
48 if ((*table)[PAGE_NR(j)] == to) {
51 table = dsc.page_dir+TO_TABLE(j);
52 if (((unsigned long) *table) == to) {
53 - copy_and_swap(*table,dsc.scratch);
54 + copy_and_swap((unsigned long) (*table),
59 Index: linux-2.4.20-rh/include/asm-i386/apic.h
60 ===================================================================
61 --- linux-2.4.20-rh.orig/include/asm-i386/apic.h 2003-10-29 23:58:49.000000000 +0800
62 +++ linux-2.4.20-rh/include/asm-i386/apic.h 2003-10-29 23:59:40.000000000 +0800
64 extern void apic_pm_unregister(struct pm_dev*);
66 extern int check_nmi_watchdog (void);
67 +extern void disable_apic_nmi_watchdog(void);
71 extern unsigned int nmi_watchdog;
73 Index: linux-2.4.20-rh/include/linux/crash.h
74 ===================================================================
75 --- linux-2.4.20-rh.orig/include/linux/crash.h 2003-10-29 23:56:02.000000000 +0800
76 +++ linux-2.4.20-rh/include/linux/crash.h 2003-10-29 23:56:17.000000000 +0800
78 #define CRASH_ZALLOC_PAGES 16*5*2 /* 2 to handle crash in crash */
79 #define CRASH_LOW_WATER_PAGES 100
81 -#define CRASH_CPU_TIMEOUT 5000 /* 5 sec wait for other cpus to stop */
82 +#define CRASH_CPU_TIMEOUT 15000 /* 15 sec wait for other cpus to stop */
84 #define CRASH_MARK_RESERVED(addr) (set_bit(PG_reserved,&mem_map[MAP_NR(addr)].flags))
85 #define CRASH_CLEAR_RESERVED(addr) (clear_bit(PG_reserved,&mem_map[MAP_NR(addr)].flags))
86 Index: linux-2.4.20-rh/arch/i386/kernel/crash.c
87 ===================================================================
88 --- linux-2.4.20-rh.orig/arch/i386/kernel/crash.c 2003-10-29 23:56:02.000000000 +0800
89 +++ linux-2.4.20-rh/arch/i386/kernel/crash.c 2003-10-29 23:56:17.000000000 +0800
91 #include <linux/crash.h>
92 #include <linux/reboot.h>
93 #include <linux/bootimg.h>
94 +#include <asm/fixmap.h>
95 +#include <asm/apic.h>
97 inline void crash_save_regs(void) {
98 static unsigned long regs[8];
101 void crash_save_current_state(struct task_struct *tp)
105 + * Here we save ebp instead of esp just in case the compiler
106 + * decides to put an extra push in before we execute this
107 + * instruction (thus invalidating our frame pointer).
109 + asm volatile("movl %%ebp,%0":"=m" (*(u_long *)&tp->thread.esp));
110 + tp->thread.eip = (u_long)crash_save_current_state;
111 + panic_ksp[smp_processor_id()] = tp->thread.esp;
116 - * Here we save ebp instead of esp just in case the compiler
117 - * decides to put an extra push in before we execute this
118 - * instruction (thus invalidating our frame pointer).
119 + * Just to be safe, disable the NMI watchdog on the calling CPU so it
120 + * doesn't get in the way while we are trying to save a dump.
122 - asm volatile("movl %%ebp,%0":"=m" (*(u_long *)&tp->thread.esp));
123 - tp->thread.eip = (u_long)crash_save_current_state;
124 - panic_ksp[smp_processor_id()] = tp->thread.esp;
126 + disable_apic_nmi_watchdog();
130 Index: linux-2.4.20-rh/arch/i386/kernel/nmi.c
131 ===================================================================
132 --- linux-2.4.20-rh.orig/arch/i386/kernel/nmi.c 2003-10-29 23:56:02.000000000 +0800
133 +++ linux-2.4.20-rh/arch/i386/kernel/nmi.c 2003-10-29 23:56:17.000000000 +0800
136 struct pm_dev *nmi_pmdev;
138 -static void disable_apic_nmi_watchdog(void)
139 +void disable_apic_nmi_watchdog(void)
141 switch (boot_cpu_data.x86_vendor) {