xcp-1.6-updates/xen-4.1.hg
changeset 23227:4cb8d9c9d46b
x86: avoid deadlock after a PCI SERR NMI
If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.
printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 24690:dcc6d57e4c07
xen-unstable date: Thu Feb 02 15:28:58 2012 +0000
If a PCI System Error (SERR) is asserted it causes an NMI. If this NMI
occurs while the CPU is in printk() then Xen may deadlock as
pci_serr_error() calls console_force_unlock() which screws up the
console lock.
printk() isn't safe to call from NMI context so defer the diagnostic
message to a softirq.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Tested-by: George Dunlap <george.dunlap@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 24690:dcc6d57e4c07
xen-unstable date: Thu Feb 02 15:28:58 2012 +0000
author | David Vrabel <david.vrabel@citrix.com> |
---|---|
date | Thu Feb 23 10:31:48 2012 +0000 (2012-02-23) |
parents | 3b9b0d4003a3 |
children | 0b0d74c97010 |
files | xen/arch/x86/traps.c xen/include/asm-x86/softirq.h |
line diff
1.1 --- a/xen/arch/x86/traps.c Thu Feb 23 10:30:50 2012 +0000 1.2 +++ b/xen/arch/x86/traps.c Thu Feb 23 10:31:48 2012 +0000 1.3 @@ -3049,6 +3049,11 @@ static void nmi_mce_softirq(void) 1.4 st->vcpu = NULL; 1.5 } 1.6 1.7 +static void pci_serr_softirq(void) 1.8 +{ 1.9 + printk("\n\nNMI - PCI system error (SERR)\n"); 1.10 +} 1.11 + 1.12 void async_exception_cleanup(struct vcpu *curr) 1.13 { 1.14 int trap; 1.15 @@ -3138,10 +3143,11 @@ static void nmi_dom0_report(unsigned int 1.16 1.17 static void pci_serr_error(struct cpu_user_regs *regs) 1.18 { 1.19 - console_force_unlock(); 1.20 - printk("\n\nNMI - PCI system error (SERR)\n"); 1.21 - 1.22 outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR error line. */ 1.23 + 1.24 + /* Would like to print a diagnostic here but can't call printk() 1.25 + from NMI context -- raise a softirq instead. */ 1.26 + raise_softirq(PCI_SERR_SOFTIRQ); 1.27 } 1.28 1.29 static void io_check_error(struct cpu_user_regs *regs) 1.30 @@ -3444,6 +3450,7 @@ void __init trap_init(void) 1.31 cpu_init(); 1.32 1.33 open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq); 1.34 + open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq); 1.35 } 1.36 1.37 long register_guest_nmi_callback(unsigned long address)
2.1 --- a/xen/include/asm-x86/softirq.h Thu Feb 23 10:30:50 2012 +0000 2.2 +++ b/xen/include/asm-x86/softirq.h Thu Feb 23 10:31:48 2012 +0000 2.3 @@ -6,6 +6,7 @@ 2.4 #define VCPU_KICK_SOFTIRQ (NR_COMMON_SOFTIRQS + 2) 2.5 2.6 #define MACHINE_CHECK_SOFTIRQ (NR_COMMON_SOFTIRQS + 3) 2.7 -#define NR_ARCH_SOFTIRQS 4 2.8 +#define PCI_SERR_SOFTIRQ (NR_COMMON_SOFTIRQS + 4) 2.9 +#define NR_ARCH_SOFTIRQS 5 2.10 2.11 #endif /* __ASM_SOFTIRQ_H__ */