Whamcloud - gitweb
b=3119
[fs/lustre-release.git] / lustre / kernel_patches / patches / dsp.patch
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(-)
8
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
13 @@ -238,9 +238,20 @@
14         int error = -ENOMEM;
15  
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");
20  
21 +               /* Before calling machine_restart(), make sure it will not
22 +                * simply call this function recursively.
23 +                */
24 +               bootimg_dsc.page_dir = NULL;
25 +               machine_restart(NULL);
26 +
27 +               /* We should never get here, but just in case... */
28 +               for (; ; )
29 +                       __asm__ __volatile__ ("hlt");
30 +       }
31 +
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
39 @@ -69,7 +69,8 @@
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),
45 +                                                     dsc.scratch);
46                                         break;
47                                 }
48                                 if ((*table)[PAGE_NR(j)] == to) {
49 @@ -79,7 +80,8 @@
50                                 }
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),
55 +                                                     dsc.scratch);
56                                         break;
57                                 }
58                         }
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
63 @@ -86,6 +86,9 @@
64  extern void apic_pm_unregister(struct pm_dev*);
65  
66  extern int check_nmi_watchdog (void);
67 +extern void disable_apic_nmi_watchdog(void);
68 +
69 +
70  
71  extern unsigned int nmi_watchdog;
72  #define NMI_NONE       0
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
77 @@ -71,7 +71,7 @@
78  #define CRASH_ZALLOC_PAGES 16*5*2      /* 2 to handle crash in crash */
79  #define CRASH_LOW_WATER_PAGES 100
80  
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 */
83  
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
90 @@ -9,6 +9,8 @@
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>
96  
97  inline void crash_save_regs(void) {
98         static unsigned long regs[8];
99 @@ -30,15 +32,23 @@
100   */
101  void crash_save_current_state(struct task_struct *tp)
102  {
103 +       if (tp != NULL) {
104 +               /*
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).
108 +                */
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;
112 +               mb();
113 +       }
114 +
115         /*
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.
121          */
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;
125 -       mb();
126 +       disable_apic_nmi_watchdog();
127  
128         save_core();
129  
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
134 @@ -138,7 +138,7 @@
135  
136  struct pm_dev *nmi_pmdev;
137  
138 -static void disable_apic_nmi_watchdog(void)
139 +void disable_apic_nmi_watchdog(void)
140  {
141         switch (boot_cpu_data.x86_vendor) {
142         case X86_VENDOR_AMD: