[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.1-testing] x86: avoid deadlock after a PCI SERR NMI



# HG changeset patch
# User David Vrabel <david.vrabel@xxxxxxxxxx>
# Date 1329993108 0
# Node ID 4cb8d9c9d46bbb64bd9ac1d7b71b085d57fe6c96
# Parent  3b9b0d4003a3fa670e64e15a7af5a5c107bc0a37
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@xxxxxxxxxx>
Tested-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset:   24690:dcc6d57e4c07
xen-unstable date:        Thu Feb 02 15:28:58 2012 +0000
---


diff -r 3b9b0d4003a3 -r 4cb8d9c9d46b xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Thu Feb 23 10:30:50 2012 +0000
+++ b/xen/arch/x86/traps.c      Thu Feb 23 10:31:48 2012 +0000
@@ -3049,6 +3049,11 @@
     st->vcpu = NULL;
 }
 
+static void pci_serr_softirq(void)
+{
+    printk("\n\nNMI - PCI system error (SERR)\n");
+}
+
 void async_exception_cleanup(struct vcpu *curr)
 {
     int trap;
@@ -3138,10 +3143,11 @@
 
 static void pci_serr_error(struct cpu_user_regs *regs)
 {
-    console_force_unlock();
-    printk("\n\nNMI - PCI system error (SERR)\n");
-
     outb((inb(0x61) & 0x0f) | 0x04, 0x61); /* clear-and-disable the PCI SERR 
error line. */
+
+    /* Would like to print a diagnostic here but can't call printk()
+       from NMI context -- raise a softirq instead. */
+    raise_softirq(PCI_SERR_SOFTIRQ);
 }
 
 static void io_check_error(struct cpu_user_regs *regs)
@@ -3444,6 +3450,7 @@
     cpu_init();
 
     open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
+    open_softirq(PCI_SERR_SOFTIRQ, pci_serr_softirq);
 }
 
 long register_guest_nmi_callback(unsigned long address)
diff -r 3b9b0d4003a3 -r 4cb8d9c9d46b xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h     Thu Feb 23 10:30:50 2012 +0000
+++ b/xen/include/asm-x86/softirq.h     Thu Feb 23 10:31:48 2012 +0000
@@ -6,6 +6,7 @@
 #define VCPU_KICK_SOFTIRQ      (NR_COMMON_SOFTIRQS + 2)
 
 #define MACHINE_CHECK_SOFTIRQ  (NR_COMMON_SOFTIRQS + 3)
-#define NR_ARCH_SOFTIRQS       4
+#define PCI_SERR_SOFTIRQ       (NR_COMMON_SOFTIRQS + 4)
+#define NR_ARCH_SOFTIRQS       5
 
 #endif /* __ASM_SOFTIRQ_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.