WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: Must use a softirq to defer dom0 NMI

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Must use a softirq to defer dom0 NMI
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jun 2008 10:20:13 -0700
Delivery-date: Wed, 18 Jun 2008 10:20:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213795030 -3600
# Node ID b55f6d42668d862170df03dc42995a0600f93fc6
# Parent  52592af0204a55abd0898b1fbe390a55036079e2
x86: Must use a softirq to defer dom0 NMI
notification. tasklet_schedule() contains a spinlock and is unsafe in
NMI context.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/traps.c          |    9 +++++----
 xen/include/asm-x86/softirq.h |    4 +++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff -r 52592af0204a -r b55f6d42668d xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Wed Jun 18 11:55:34 2008 +0100
+++ b/xen/arch/x86/traps.c      Wed Jun 18 14:17:10 2008 +0100
@@ -2678,14 +2678,12 @@ asmlinkage void do_general_protection(st
     panic("GENERAL PROTECTION FAULT\n[error_code=%04x]\n", regs->error_code);
 }
 
-static void nmi_action(unsigned long unused)
+static void nmi_mce_softirq(void)
 {
     /* Only used to defer wakeup of dom0,vcpu0 to a safe (non-NMI) context. */
     vcpu_kick(dom0->vcpu[0]);
 }
 
-static DECLARE_TASKLET(nmi_tasklet, nmi_action, 0);
-
 static void nmi_dom0_report(unsigned int reason_idx)
 {
     struct domain *d;
@@ -2696,8 +2694,9 @@ static void nmi_dom0_report(unsigned int
 
     set_bit(reason_idx, nmi_reason(d));
 
+    /* Not safe to wake a vcpu here, or even to schedule a tasklet! */
     if ( !test_and_set_bool(v->nmi_pending) )
-        tasklet_schedule(&nmi_tasklet); /* not safe to wake a vcpu here */
+        raise_softirq(NMI_MCE_SOFTIRQ);
 }
 
 asmlinkage void mem_parity_error(struct cpu_user_regs *regs)
@@ -2975,6 +2974,8 @@ void __init trap_init(void)
     percpu_traps_init();
 
     cpu_init();
+
+    open_softirq(NMI_MCE_SOFTIRQ, nmi_mce_softirq);
 }
 
 long register_guest_nmi_callback(unsigned long address)
diff -r 52592af0204a -r b55f6d42668d xen/include/asm-x86/softirq.h
--- a/xen/include/asm-x86/softirq.h     Wed Jun 18 11:55:34 2008 +0100
+++ b/xen/include/asm-x86/softirq.h     Wed Jun 18 14:17:10 2008 +0100
@@ -1,6 +1,8 @@
 #ifndef __ASM_SOFTIRQ_H__
 #define __ASM_SOFTIRQ_H__
 
-#define NR_ARCH_SOFTIRQS    0
+#define NMI_MCE_SOFTIRQ     (NR_COMMON_SOFTIRQS + 0)
+
+#define NR_ARCH_SOFTIRQS    1
 
 #endif /* __ASM_SOFTIRQ_H__ */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Must use a softirq to defer dom0 NMI, Xen patchbot-unstable <=