aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/traps.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2012-02-02 15:28:58 +0000
committerDavid Vrabel <david.vrabel@citrix.com>2012-02-02 15:28:58 +0000
commit7d44891ccc13b842b9f135c77233d4d56720e219 (patch)
tree2a9572399a1aa050dfa3e076b7f7f2b6f74b8572 /xen/arch/x86/traps.c
parenta6b64c00c491c5e563e90bda35b2e4ccc02edb94 (diff)
downloadxen-7d44891ccc13b842b9f135c77233d4d56720e219.tar.gz
xen-7d44891ccc13b842b9f135c77233d4d56720e219.tar.bz2
xen-7d44891ccc13b842b9f135c77233d4d56720e219.zip
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>
Diffstat (limited to 'xen/arch/x86/traps.c')
-rw-r--r--xen/arch/x86/traps.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 2057ac5c2e..286f1a2954 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -3173,6 +3173,11 @@ static void nmi_mce_softirq(void)
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;
@@ -3259,10 +3264,11 @@ static void nmi_dom0_report(unsigned int reason_idx)
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)
@@ -3563,6 +3569,7 @@ void __init trap_init(void)
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)