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

Re: [Xen-devel] [v3 08/15] Suppress posting interrupts when 'SN' is set



On 24/06/15 06:18, Feng Wu wrote:
> Currently, we don't support urgent interrupt, all interrupts
> are recognized as non-urgent interrupt, so we cannot send
> posted-interrupt when 'SN' is set.
>
> Signed-off-by: Feng Wu <feng.wu@xxxxxxxxx>
> ---
> v3:
> use cmpxchg to test SN/ON and set ON
>
>  xen/arch/x86/hvm/vmx/vmx.c | 32 ++++++++++++++++++++++++++++----
>  1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 0837627..b94ef6a 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -1686,6 +1686,8 @@ static void __vmx_deliver_posted_interrupt(struct vcpu 
> *v)
>  
>  static void vmx_deliver_posted_intr(struct vcpu *v, u8 vector)
>  {
> +    struct pi_desc old, new, prev;

These should be moved into the else clause below, to reduce their scope.

> +
>      if ( pi_test_and_set_pir(vector, &v->arch.hvm_vmx.pi_desc) )
>          return;
>  
> @@ -1698,13 +1700,35 @@ static void vmx_deliver_posted_intr(struct vcpu *v, 
> u8 vector)
>           */
>          pi_set_on(&v->arch.hvm_vmx.pi_desc);
>      }
> -    else if ( !pi_test_and_set_on(&v->arch.hvm_vmx.pi_desc) )
> +    else
>      {
> +        prev.control = 0;
> +
> +        do {
> +            old.control = v->arch.hvm_vmx.pi_desc.control &
> +                          ~(1 << POSTED_INTR_ON | 1 << POSTED_INTR_SN);

Brackets around each of the 1 << $NNN please.

> +            new.control = v->arch.hvm_vmx.pi_desc.control |
> +                          1 << POSTED_INTR_ON;
> +
> +            /*
> +             * Currently, we don't support urgent interrupt, all
> +             * interrupts are recognized as non-urgent interrupt,
> +             * so we cannot send posted-interrupt when 'SN' is set.
> +             * Besides that, if 'ON' is already set, we cannot set
> +             * posted-interrupts as well.
> +             */
> +            if ( prev.sn || prev.on )
> +            {
> +                vcpu_kick(v);
> +                return;
> +            }
> +
> +            prev.control = cmpxchg(&v->arch.hvm_vmx.pi_desc.control,
> +                                   old.control, new.control);
> +        } while ( prev.control != old.control );
> +
>          __vmx_deliver_posted_interrupt(v);
> -        return;
>      }
> -
> -    vcpu_kick(v);

This removes a vcpu_kick() from the eoi_exitmap_changed path, which I
suspect is not what you intend.

~Andrew

>  }
>  
>  static void vmx_sync_pir_to_irr(struct vcpu *v)


_______________________________________________
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®.