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

RE: [PATCH] x86/vmx: reorder code in vmx_deliver_posted_intr


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Fri, 14 Aug 2020 05:49:08 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oIxBSQI7msz/K/WRvG6Tlv1HtvoGGDXamqo4cesr+/c=; b=LZVf6Bhl3JkDwYdry7gFnj4Mg8Z0GrrtoLje3T7zoiBwUrj0iJmumOjLB9A5bVS5GNlX7LSMuz0EtfNsqcr2kT0VQ23rPnaORkxPcr/lI3gaBXawtaby4EcYHyzzHUyhW4Woq6xFrbMtBrtHFhTlPAAiPe0DZBRoMIi18BaAYcQlZqhHBf9AUafoDjx9KU3CZ1RIYECc7cNyDbdbl+ooiRrUskYWGhW/pU2NKmi5YABI78Sy/+dAncgAAeGouQZ9+hrjAGJTQlouUEWgwLvM7ojmpQjyi01Mp8u4IGmubo+bcFPqHVlpMI5E8SmGffL6sSY9HtfgJ0mm4WUU1Xdl3g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jrvnW5oEKsWuaSZ+uvZli4FwWYeQGXkb0Q7dwFP6vN7WTSGm8MsE3swaMdxKKHcpjFq4tkX/LCEEC9ou5+KTNA/T1RCXkSXq4+kL4o2m2rDizQERamBjXTK6Gspjv+gvt5OQgu7qPPkHw1Kdkh8MvAwzGf1sDcilOh6u43hpgV48EFYBwIewcDyFtyQJDC+ykIVQIxMRbl0pmNPN2C7RNPk+zm13xHkD0qydp/4diKW8jemg+H7RSCOcXHPIFsggJvkiAn1q6ev3HLMYkjIns4EHog+AOQO/NZXSIEVBA2UjooYrHCS48OqEqWXz0PEPRoQvMjqiLXhtVLYujht11w==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=intel.com;
  • Cc: "Nakajima, Jun" <jun.nakajima@xxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 05:49:47 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.5.1.3
  • Ironport-sdr: KfBgkyjYYju6SLXFkZU5Ngst67CZ/WdbAq7KuC1y/vST+XgBz5+KU4Iy/iGvVIPfpxBcYEy2eg eo7fvs+PpPFQ==
  • Ironport-sdr: /gsQ8DMMYbAoqH3NRVUQyoJiIrWfyf7ex2Z4g4ZpDbVw/gdhzKP9lrbBwEMxiRwHSHKvDwGpS/ 9rtBjurtLBsA==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWZnpX5qSV7E8ra0mIfy49Y9eyi6k3MDJw
  • Thread-topic: [PATCH] x86/vmx: reorder code in vmx_deliver_posted_intr

> From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> Sent: Thursday, July 30, 2020 10:03 PM
> 
> Remove the unneeded else branch, which allows to reduce the
> indentation of a larger block of code, while making the flow of the
> function more obvious.
> 
> No functional change intended.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
>  xen/arch/x86/hvm/vmx/vmx.c | 55 ++++++++++++++++++--------------------
>  1 file changed, 26 insertions(+), 29 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index eb54aadfba..7773dcae1b 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -2003,6 +2003,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;
> +
>      if ( pi_test_and_set_pir(vector, &v->arch.hvm.vmx.pi_desc) )
>          return;
> 
> @@ -2014,41 +2016,36 @@ static void vmx_deliver_posted_intr(struct vcpu
> *v, u8 vector)
>           * VMEntry as it used to be.
>           */
>          pi_set_on(&v->arch.hvm.vmx.pi_desc);
> +        vcpu_kick(v);
> +        return;
>      }
> -    else
> -    {
> -        struct pi_desc old, new, prev;
> 
> -        prev.control = v->arch.hvm.vmx.pi_desc.control;
> +    prev.control = v->arch.hvm.vmx.pi_desc.control;
> 
> -        do {
> -            /*
> -             * Currently, we don't support urgent interrupt, all
> -             * interrupts are recognized as non-urgent interrupt,
> -             * Besides that, if 'ON' is already set, no need to
> -             * sent posted-interrupts notification event as well,
> -             * according to hardware behavior.
> -             */
> -            if ( pi_test_sn(&prev) || pi_test_on(&prev) )
> -            {
> -                vcpu_kick(v);
> -                return;
> -            }
> -
> -            old.control = v->arch.hvm.vmx.pi_desc.control &
> -                          ~((1 << POSTED_INTR_ON) | (1 << POSTED_INTR_SN));
> -            new.control = v->arch.hvm.vmx.pi_desc.control |
> -                          (1 << POSTED_INTR_ON);
> +    do {
> +        /*
> +         * Currently, we don't support urgent interrupt, all
> +         * interrupts are recognized as non-urgent interrupt,
> +         * Besides that, if 'ON' is already set, no need to
> +         * sent posted-interrupts notification event as well,
> +         * according to hardware behavior.
> +         */
> +        if ( pi_test_sn(&prev) || pi_test_on(&prev) )
> +        {
> +            vcpu_kick(v);
> +            return;
> +        }
> 
> -            prev.control = cmpxchg(&v->arch.hvm.vmx.pi_desc.control,
> -                                   old.control, new.control);
> -        } while ( prev.control != old.control );
> +        old.control = v->arch.hvm.vmx.pi_desc.control &
> +                      ~((1 << POSTED_INTR_ON) | (1 << POSTED_INTR_SN));
> +        new.control = v->arch.hvm.vmx.pi_desc.control |
> +                      (1 << POSTED_INTR_ON);
> 
> -        __vmx_deliver_posted_interrupt(v);
> -        return;
> -    }
> +        prev.control = cmpxchg(&v->arch.hvm.vmx.pi_desc.control,
> +                               old.control, new.control);
> +    } while ( prev.control != old.control );
> 
> -    vcpu_kick(v);
> +    __vmx_deliver_posted_interrupt(v);
>  }
> 
>  static void vmx_sync_pir_to_irr(struct vcpu *v)
> --
> 2.28.0


 


Rackspace

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