direct-io.hg

changeset 11676:ef8df1e5884f

[XEN][HVM] Arrange that we only consider sending a PV-on-HVM event channel
callback interrupt in vcpu 0. This avoids a race in SMP HVM domains
which could lead to interrupts never getting delivered. It is safe
because HVM domains always bind their event channels to vcpu 0.

Bug pointed out by Keir.

Signed-off-by: Steven Smith <sos22@cam.ac.uk>
author Steven Smith <ssmith@xensource.com>
date Fri Sep 29 15:40:19 2006 +0100 (2006-09-29)
parents 509ff527c59d
children 593b5623a0d2
files xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/vmx/io.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/intr.c	Fri Sep 29 14:42:49 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/intr.c	Fri Sep 29 15:40:19 2006 +0100
     1.3 @@ -121,9 +121,12 @@ asmlinkage void svm_intr_assist(void)
     1.4            pic_set_irq(pic, pt->irq, 1);
     1.5        }
     1.6  
     1.7 -      callback_irq = v->domain->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
     1.8 -      if ( callback_irq != 0)
     1.9 -          pic_set_xen_irq(pic, callback_irq, local_events_need_delivery());
    1.10 +      if (v->vcpu_id == 0) {
    1.11 +          callback_irq =
    1.12 +              v->domain->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
    1.13 +          if ( callback_irq != 0)
    1.14 +              pic_set_xen_irq(pic, callback_irq, local_events_need_delivery());
    1.15 +      }
    1.16  
    1.17        if ( cpu_has_pending_irq(v) )
    1.18            intr_vector = cpu_get_interrupt(v, &intr_type);
     2.1 --- a/xen/arch/x86/hvm/vmx/io.c	Fri Sep 29 14:42:49 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/io.c	Fri Sep 29 15:40:19 2006 +0100
     2.3 @@ -78,7 +78,6 @@ asmlinkage void vmx_intr_assist(void)
     2.4      struct hvm_domain *plat=&v->domain->arch.hvm_domain;
     2.5      struct periodic_time *pt = &plat->pl_time.periodic_tm;
     2.6      struct hvm_virpic *pic= &plat->vpic;
     2.7 -    int callback_irq;
     2.8      unsigned int idtv_info_field;
     2.9      unsigned long inst_len;
    2.10      int    has_ext_irq;
    2.11 @@ -91,9 +90,13 @@ asmlinkage void vmx_intr_assist(void)
    2.12          pic_set_irq(pic, pt->irq, 1);
    2.13      }
    2.14  
    2.15 -    callback_irq = v->domain->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
    2.16 -    if ( callback_irq != 0 )
    2.17 -        pic_set_xen_irq(pic, callback_irq, local_events_need_delivery());
    2.18 +    if (v->vcpu_id == 0) {
    2.19 +        int callback_irq;
    2.20 +        callback_irq =
    2.21 +            v->domain->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
    2.22 +        if ( callback_irq != 0 )
    2.23 +            pic_set_xen_irq(pic, callback_irq, local_events_need_delivery());
    2.24 +    }
    2.25  
    2.26      has_ext_irq = cpu_has_pending_irq(v);
    2.27