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

Re: [Xen-devel] [PATCH 10/18] PVH xen: interrupt/event-channel delivery to PVH



On Mon, Jun 24, 2013 at 05:01:39PM -0700, Mukesh Rathor wrote:
> PVH uses HVMIRQ_callback_vector for interrupt delivery. Also, change
> hvm_vcpu_has_pending_irq() as PVH doesn't use vlapic emulation.

Please explain why it can't use the normal "if .." in the
hvm_vcpu_has_pending_irq.

I figured it is b/c the guest boots in an HVM container so the
event mechanism is offline until it gets enabled. And that means
no HVM type interrupts (so emulated timer interrupts say) should interrupt
it until the event mechanism (or rather the callback vector) is in place.

But that is conjecture on my part and I would appreciate you putting
that in the git commit.

The reasoning is if somebody decides one day to take the knife to
hvm_vcpu_has_pending_irq() they will know what to expect and what
to test for.

Thank you.
> 
> Signed-off-by: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>
> ---
>  xen/arch/x86/hvm/irq.c       |    3 +++
>  xen/arch/x86/hvm/vmx/intr.c  |    8 ++++++--
>  xen/include/asm-x86/domain.h |    2 +-
>  xen/include/asm-x86/event.h  |    2 +-
>  4 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
> index 9eae5de..92fb245 100644
> --- a/xen/arch/x86/hvm/irq.c
> +++ b/xen/arch/x86/hvm/irq.c
> @@ -405,6 +405,9 @@ struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v)
>           && vcpu_info(v, evtchn_upcall_pending) )
>          return hvm_intack_vector(plat->irq.callback_via.vector);
>  
> +    if ( is_pvh_vcpu(v) )
> +        return hvm_intack_none;
> +
>      if ( vlapic_accept_pic_intr(v) && plat->vpic[0].int_output )
>          return hvm_intack_pic(0);
>  
> diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
> index e376f3c..ce42950 100644
> --- a/xen/arch/x86/hvm/vmx/intr.c
> +++ b/xen/arch/x86/hvm/vmx/intr.c
> @@ -165,6 +165,9 @@ static int nvmx_intr_intercept(struct vcpu *v, struct 
> hvm_intack intack)
>  {
>      u32 ctrl;
>  
> +    if ( is_pvh_vcpu(v) )
> +        return 0;
> +
>      if ( nvmx_intr_blocked(v) != hvm_intblk_none )
>      {
>          enable_intr_window(v, intack);
> @@ -219,8 +222,9 @@ void vmx_intr_assist(void)
>          return;
>      }
>  
> -    /* Crank the handle on interrupt state. */
> -    pt_vector = pt_update_irq(v);
> +    if ( !is_pvh_vcpu(v) )
> +        /* Crank the handle on interrupt state. */
> +        pt_vector = pt_update_irq(v);
>  
>      do {
>          intack = hvm_vcpu_has_pending_irq(v);
> diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
> index c3f9f8e..b95314a 100644
> --- a/xen/include/asm-x86/domain.h
> +++ b/xen/include/asm-x86/domain.h
> @@ -16,7 +16,7 @@
>  #define is_pv_32on64_domain(d) (is_pv_32bit_domain(d))
>  #define is_pv_32on64_vcpu(v)   (is_pv_32on64_domain((v)->domain))
>  
> -#define is_hvm_pv_evtchn_domain(d) (is_hvm_domain(d) && \
> +#define is_hvm_pv_evtchn_domain(d) (!is_pv_domain(d) && \
>          d->arch.hvm_domain.irq.callback_via_type == HVMIRQ_callback_vector)
>  #define is_hvm_pv_evtchn_vcpu(v) (is_hvm_pv_evtchn_domain(v->domain))
>  
> diff --git a/xen/include/asm-x86/event.h b/xen/include/asm-x86/event.h
> index 06057c7..7ed5812 100644
> --- a/xen/include/asm-x86/event.h
> +++ b/xen/include/asm-x86/event.h
> @@ -18,7 +18,7 @@ int hvm_local_events_need_delivery(struct vcpu *v);
>  static inline int local_events_need_delivery(void)
>  {
>      struct vcpu *v = current;
> -    return (is_hvm_vcpu(v) ? hvm_local_events_need_delivery(v) :
> +    return (!is_pv_vcpu(v) ? hvm_local_events_need_delivery(v) :
>              (vcpu_info(v, evtchn_upcall_pending) &&
>               !vcpu_info(v, evtchn_upcall_mask)));
>  }
> -- 
> 1.7.2.3
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.