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

[Xen-changelog] [xen-unstable] x86 hvm: hvm_set_callback_irq_level() must not be called in IRQ



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1241779812 -3600
# Node ID 2656ab6fa8286832ca7de3082d72e2406097f3ff
# Parent  bf946cc3008bcb927bf28de87160cc4ec2b180c0
x86 hvm: hvm_set_callback_irq_level() must not be called in IRQ
context or with IRQs disabled. Ensure this by deferring to tasklet
(softirq) context if required.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c         |    5 +++++
 xen/arch/x86/hvm/irq.c         |   12 ++++++++++--
 xen/include/asm-x86/hvm/vcpu.h |    2 ++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff -r bf946cc3008b -r 2656ab6fa828 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Thu May 07 19:32:10 2009 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Fri May 08 11:50:12 2009 +0100
@@ -697,6 +697,10 @@ int hvm_vcpu_initialise(struct vcpu *v)
     if ( rc != 0 )
         goto fail3;
 
+    tasklet_init(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet,
+                 (void(*)(unsigned long))hvm_assert_evtchn_irq,
+                 (unsigned long)v);
+
     v->arch.guest_context.user_regs.eflags = 2;
 
     if ( v->vcpu_id == 0 )
@@ -726,6 +730,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
 
 void hvm_vcpu_destroy(struct vcpu *v)
 {
+    tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
     hvm_vcpu_cacheattr_destroy(v);
     vlapic_destroy(v);
     hvm_funcs.vcpu_destroy(v);
diff -r bf946cc3008b -r 2656ab6fa828 xen/arch/x86/hvm/irq.c
--- a/xen/arch/x86/hvm/irq.c    Thu May 07 19:32:10 2009 +0100
+++ b/xen/arch/x86/hvm/irq.c    Fri May 08 11:50:12 2009 +0100
@@ -185,8 +185,16 @@ void hvm_maybe_deassert_evtchn_irq(void)
 
 void hvm_assert_evtchn_irq(struct vcpu *v)
 {
-    if ( v->vcpu_id == 0 )
-        hvm_set_callback_irq_level(v);
+    if ( v->vcpu_id != 0 )
+        return;
+
+    if ( unlikely(in_irq() || !local_irq_is_enabled()) )
+    {
+        tasklet_schedule(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
+        return;
+    }
+
+    hvm_set_callback_irq_level(v);
 }
 
 void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
diff -r bf946cc3008b -r 2656ab6fa828 xen/include/asm-x86/hvm/vcpu.h
--- a/xen/include/asm-x86/hvm/vcpu.h    Thu May 07 19:32:10 2009 +0100
+++ b/xen/include/asm-x86/hvm/vcpu.h    Fri May 08 11:50:12 2009 +0100
@@ -66,6 +66,8 @@ struct hvm_vcpu {
         struct arch_svm_struct svm;
     } u;
 
+    struct tasklet      assert_evtchn_irq_tasklet;
+
     struct mtrr_state   mtrr;
     u64                 pat_cr;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.