ia64/xen-unstable

changeset 19595:2656ab6fa828

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@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri May 08 11:50:12 2009 +0100 (2009-05-08)
parents bf946cc3008b
children c6b7c6a3e5b3
files xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/irq.c xen/include/asm-x86/hvm/vcpu.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Thu May 07 19:32:10 2009 +0100
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Fri May 08 11:50:12 2009 +0100
     1.3 @@ -697,6 +697,10 @@ int hvm_vcpu_initialise(struct vcpu *v)
     1.4      if ( rc != 0 )
     1.5          goto fail3;
     1.6  
     1.7 +    tasklet_init(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet,
     1.8 +                 (void(*)(unsigned long))hvm_assert_evtchn_irq,
     1.9 +                 (unsigned long)v);
    1.10 +
    1.11      v->arch.guest_context.user_regs.eflags = 2;
    1.12  
    1.13      if ( v->vcpu_id == 0 )
    1.14 @@ -726,6 +730,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
    1.15  
    1.16  void hvm_vcpu_destroy(struct vcpu *v)
    1.17  {
    1.18 +    tasklet_kill(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
    1.19      hvm_vcpu_cacheattr_destroy(v);
    1.20      vlapic_destroy(v);
    1.21      hvm_funcs.vcpu_destroy(v);
     2.1 --- a/xen/arch/x86/hvm/irq.c	Thu May 07 19:32:10 2009 +0100
     2.2 +++ b/xen/arch/x86/hvm/irq.c	Fri May 08 11:50:12 2009 +0100
     2.3 @@ -185,8 +185,16 @@ void hvm_maybe_deassert_evtchn_irq(void)
     2.4  
     2.5  void hvm_assert_evtchn_irq(struct vcpu *v)
     2.6  {
     2.7 -    if ( v->vcpu_id == 0 )
     2.8 -        hvm_set_callback_irq_level(v);
     2.9 +    if ( v->vcpu_id != 0 )
    2.10 +        return;
    2.11 +
    2.12 +    if ( unlikely(in_irq() || !local_irq_is_enabled()) )
    2.13 +    {
    2.14 +        tasklet_schedule(&v->arch.hvm_vcpu.assert_evtchn_irq_tasklet);
    2.15 +        return;
    2.16 +    }
    2.17 +
    2.18 +    hvm_set_callback_irq_level(v);
    2.19  }
    2.20  
    2.21  void hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq)
     3.1 --- a/xen/include/asm-x86/hvm/vcpu.h	Thu May 07 19:32:10 2009 +0100
     3.2 +++ b/xen/include/asm-x86/hvm/vcpu.h	Fri May 08 11:50:12 2009 +0100
     3.3 @@ -66,6 +66,8 @@ struct hvm_vcpu {
     3.4          struct arch_svm_struct svm;
     3.5      } u;
     3.6  
     3.7 +    struct tasklet      assert_evtchn_irq_tasklet;
     3.8 +
     3.9      struct mtrr_state   mtrr;
    3.10      u64                 pat_cr;
    3.11