direct-io.hg
changeset 2041:7eabdea08bd0
bitkeeper revision 1.1108.53.1 (410f49091nUueqW95skYILdr1AOlpQ)
Fix NMI error code to correctly print a crash dump before hanging.
Fix NMI error code to correctly print a crash dump before hanging.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Tue Aug 03 08:12:57 2004 +0000 (2004-08-03) |
parents | b7e842452bff |
children | c3dfea0ee5cf |
files | xen/arch/x86/nmi.c xen/arch/x86/traps.c xen/arch/x86/x86_32/entry.S xen/drivers/char/console.c xen/drivers/char/serial.c xen/include/xen/console.h xen/include/xen/serial.h |
line diff
1.1 --- a/xen/arch/x86/nmi.c Mon Aug 02 14:57:37 2004 +0000 1.2 +++ b/xen/arch/x86/nmi.c Tue Aug 03 08:12:57 2004 +0000 1.3 @@ -20,6 +20,7 @@ 1.4 #include <xen/delay.h> 1.5 #include <xen/time.h> 1.6 #include <xen/sched.h> 1.7 +#include <xen/console.h> 1.8 #include <asm/mc146818rtc.h> 1.9 #include <asm/smp.h> 1.10 #include <asm/msr.h> 1.11 @@ -271,7 +272,6 @@ void touch_nmi_watchdog (void) 1.12 1.13 void nmi_watchdog_tick (struct pt_regs * regs) 1.14 { 1.15 - extern spinlock_t console_lock; 1.16 extern void die(const char * str, struct pt_regs * regs, long err); 1.17 1.18 int sum, cpu = smp_processor_id(); 1.19 @@ -285,8 +285,9 @@ void nmi_watchdog_tick (struct pt_regs * 1.20 * before doing the oops ... 1.21 */ 1.22 alert_counter[cpu]++; 1.23 - if (alert_counter[cpu] == 5*nmi_hz) { 1.24 - console_lock = SPIN_LOCK_UNLOCKED; 1.25 + if ( alert_counter[cpu] == 5*nmi_hz ) 1.26 + { 1.27 + console_force_unlock(); 1.28 die("NMI Watchdog detected LOCKUP on CPU", regs, cpu); 1.29 } 1.30 }
2.1 --- a/xen/arch/x86/traps.c Mon Aug 02 14:57:37 2004 +0000 2.2 +++ b/xen/arch/x86/traps.c Tue Aug 03 08:12:57 2004 +0000 2.3 @@ -33,6 +33,7 @@ 2.4 #include <xen/lib.h> 2.5 #include <xen/errno.h> 2.6 #include <xen/mm.h> 2.7 +#include <xen/console.h> 2.8 #include <asm/ptrace.h> 2.9 #include <xen/delay.h> 2.10 #include <xen/spinlock.h> 2.11 @@ -140,7 +141,7 @@ void show_registers(struct pt_regs *regs 2.12 unsigned long esp; 2.13 unsigned short ss; 2.14 2.15 - esp = (unsigned long) (®s->esp); 2.16 + esp = (unsigned long)(®s->esp); 2.17 ss = __HYPERVISOR_DS; 2.18 if ( regs->xcs & 3 ) 2.19 { 2.20 @@ -271,7 +272,6 @@ DO_ERROR_NOCODE( 0, "divide error", divi 2.21 2.22 asmlinkage void do_double_fault(void) 2.23 { 2.24 - extern spinlock_t console_lock; 2.25 struct tss_struct *tss = &doublefault_tss; 2.26 unsigned int cpu = ((tss->back_link>>3)-__FIRST_TSS_ENTRY)>>1; 2.27 2.28 @@ -295,7 +295,7 @@ asmlinkage void do_double_fault(void) 2.29 printk("************************************\n"); 2.30 2.31 /* Lock up the console to prevent spurious output from other CPUs. */ 2.32 - spin_lock(&console_lock); 2.33 + console_force_lock(); 2.34 2.35 /* Wait for manual reset. */ 2.36 for ( ; ; ) ; 2.37 @@ -472,9 +472,11 @@ asmlinkage void do_general_protection(st 2.38 die("general protection fault", regs, error_code); 2.39 } 2.40 2.41 -asmlinkage void mem_parity_error(unsigned char reason, struct pt_regs * regs) 2.42 +asmlinkage void mem_parity_error(unsigned char reason, struct pt_regs *regs) 2.43 { 2.44 - printk("NMI received. Dazed and confused, but trying to continue\n"); 2.45 + console_force_unlock(); 2.46 + 2.47 + printk("\n\nNMI received. Dazed and confused, but trying to continue\n"); 2.48 printk("You probably have a hardware problem with your RAM chips\n"); 2.49 2.50 /* Clear and disable the memory parity error line. */ 2.51 @@ -482,18 +484,40 @@ asmlinkage void mem_parity_error(unsigne 2.52 outb(reason, 0x61); 2.53 2.54 show_registers(regs); 2.55 - panic("PARITY ERROR"); 2.56 + 2.57 + printk("************************************\n"); 2.58 + printk("CPU%d MEMORY ERROR -- system shutdown\n", smp_processor_id()); 2.59 + printk("System needs manual reset.\n"); 2.60 + printk("************************************\n"); 2.61 + 2.62 + /* Lock up the console to prevent spurious output from other CPUs. */ 2.63 + console_force_lock(); 2.64 + 2.65 + /* Wait for manual reset. */ 2.66 + for ( ; ; ) ; 2.67 } 2.68 2.69 -asmlinkage void io_check_error(unsigned char reason, struct pt_regs * regs) 2.70 +asmlinkage void io_check_error(unsigned char reason, struct pt_regs *regs) 2.71 { 2.72 - printk("NMI: IOCK error (debug interrupt?)\n"); 2.73 + console_force_unlock(); 2.74 + 2.75 + printk("\n\nNMI: IOCK error (debug interrupt?)\n"); 2.76 2.77 reason = (reason & 0xf) | 8; 2.78 outb(reason, 0x61); 2.79 2.80 show_registers(regs); 2.81 - panic("IOCK ERROR"); 2.82 + 2.83 + printk("************************************\n"); 2.84 + printk("CPU%d I/O ERROR -- system shutdown\n", smp_processor_id()); 2.85 + printk("System needs manual reset.\n"); 2.86 + printk("************************************\n"); 2.87 + 2.88 + /* Lock up the console to prevent spurious output from other CPUs. */ 2.89 + console_force_lock(); 2.90 + 2.91 + /* Wait for manual reset. */ 2.92 + for ( ; ; ) ; 2.93 } 2.94 2.95 static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs)
3.1 --- a/xen/arch/x86/x86_32/entry.S Mon Aug 02 14:57:37 2004 +0000 3.2 +++ b/xen/arch/x86/x86_32/entry.S Tue Aug 03 08:12:57 2004 +0000 3.3 @@ -602,7 +602,7 @@ ENTRY(nmi) 3.4 # reload DS and ES when handling them. 3.5 inb $0x61,%al 3.6 testb $0x80,%al 3.7 - jne nmi_parity_err 3.8 + je nmi_parity_err 3.9 testb $0x40,%al 3.10 jne nmi_io_err 3.11 movl %eax,%ebx 3.12 @@ -660,14 +660,22 @@ nmi_parity_err: 3.13 movl $(__HYPERVISOR_DS),%edx 3.14 movl %edx,%ds 3.15 movl %edx,%es 3.16 - jmp SYMBOL_NAME(mem_parity_error) 3.17 + movl %esp,%edx 3.18 + push %edx 3.19 + push %eax 3.20 + call SYMBOL_NAME(mem_parity_error) 3.21 + ud2 3.22 3.23 nmi_io_err: 3.24 movl $(__HYPERVISOR_DS),%edx 3.25 movl %edx,%ds 3.26 movl %edx,%es 3.27 - jmp SYMBOL_NAME(io_check_error) 3.28 - 3.29 + movl %esp,%edx 3.30 + push %edx 3.31 + push %eax 3.32 + call SYMBOL_NAME(io_check_error) 3.33 + ud2 3.34 + 3.35 .data 3.36 ENTRY(hypercall_table) 3.37 .long SYMBOL_NAME(do_set_trap_table) /* 0 */
4.1 --- a/xen/drivers/char/console.c Mon Aug 02 14:57:37 2004 +0000 4.2 +++ b/xen/drivers/char/console.c Tue Aug 03 08:12:57 2004 +0000 4.3 @@ -433,6 +433,17 @@ void console_endboot(int disable_vga) 4.4 switch_serial_input(); 4.5 } 4.6 4.7 +void console_force_unlock(void) 4.8 +{ 4.9 + console_lock = SPIN_LOCK_UNLOCKED; 4.10 + serial_force_unlock(sercon_handle); 4.11 +} 4.12 + 4.13 +void console_force_lock(void) 4.14 +{ 4.15 + spin_lock(&console_lock); 4.16 +} 4.17 + 4.18 4.19 /* 4.20 * **************************************************************
5.1 --- a/xen/drivers/char/serial.c Mon Aug 02 14:57:37 2004 +0000 5.2 +++ b/xen/drivers/char/serial.c Tue Aug 03 08:12:57 2004 +0000 5.3 @@ -459,3 +459,10 @@ unsigned char serial_getc(int handle) 5.4 spin_unlock_irqrestore(&uart->lock, flags); 5.5 return c; 5.6 } 5.7 + 5.8 +void serial_force_unlock(int handle) 5.9 +{ 5.10 + uart_t *uart = &com[handle & SERHND_IDX]; 5.11 + if ( handle != -1 ) 5.12 + uart->lock = SPIN_LOCK_UNLOCKED; 5.13 +}
6.1 --- a/xen/include/xen/console.h Mon Aug 02 14:57:37 2004 +0000 6.2 +++ b/xen/include/xen/console.h Tue Aug 03 08:12:57 2004 +0000 6.3 @@ -19,4 +19,7 @@ long read_console_ring(unsigned long, un 6.4 void init_console(void); 6.5 void console_endboot(int disable_vga); 6.6 6.7 +void console_force_unlock(void); 6.8 +void console_force_lock(void); 6.9 + 6.10 #endif
7.1 --- a/xen/include/xen/serial.h Mon Aug 02 14:57:37 2004 +0000 7.2 +++ b/xen/include/xen/serial.h Tue Aug 03 08:12:57 2004 +0000 7.3 @@ -43,4 +43,6 @@ void serial_puts(int handle, const unsig 7.4 */ 7.5 unsigned char serial_getc(int handle); 7.6 7.7 +void serial_force_unlock(int handle); 7.8 + 7.9 #endif /* __XEN_SERIAL_H__ */