From: "Tian, Kevin" <kevin.tian@intel.com>
To: Roger Pau Monne <roger.pau@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Nakajima, Jun" <jun.nakajima@intel.com>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>
Subject: RE: [PATCH] x86/vmx: reorder code in vmx_deliver_posted_intr
Date: Fri, 14 Aug 2020 05:49:08 +0000 [thread overview]
Message-ID: <MWHPR11MB16458D33512361590748B1DA8C400@MWHPR11MB1645.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200730140309.59916-1-roger.pau@citrix.com>
> From: Roger Pau Monne <roger.pau@citrix.com>
> 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@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> ---
> 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
prev parent reply other threads:[~2020-08-14 5:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 14:03 [PATCH] x86/vmx: reorder code in vmx_deliver_posted_intr Roger Pau Monne
2020-07-31 13:05 ` Jan Beulich
2020-07-31 13:56 ` Roger Pau Monné
2020-08-14 5:49 ` Tian, Kevin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MWHPR11MB16458D33512361590748B1DA8C400@MWHPR11MB1645.namprd11.prod.outlook.com \
--to=kevin.tian@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).