All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v3 3/4] x86: limit issuing of IBPB during context switch
Date: Wed, 25 Jan 2023 16:26:39 +0100	[thread overview]
Message-ID: <c39faba2-1ab6-71da-f748-1545aac8290b@suse.com> (raw)
In-Reply-To: <930254a6-d0c8-4910-982a-bfd227187240@suse.com>

When the outgoing vCPU had IBPB issued upon entering Xen there's no
need for a 2nd barrier during context switch.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v3: Fold into series.

--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2015,7 +2015,8 @@ void context_switch(struct vcpu *prev, s
 
         ctxt_switch_levelling(next);
 
-        if ( opt_ibpb_ctxt_switch && !is_idle_domain(nextd) )
+        if ( opt_ibpb_ctxt_switch && !is_idle_domain(nextd) &&
+             !(prevd->arch.spec_ctrl_flags & SCF_entry_ibpb) )
         {
             static DEFINE_PER_CPU(unsigned int, last);
             unsigned int *last_id = &this_cpu(last);



  parent reply	other threads:[~2023-01-25 15:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 15:24 [PATCH v3 0/4] x86/spec-ctrl: IPBP improvements Jan Beulich
2023-01-25 15:25 ` [PATCH v3 1/4] x86/spec-ctrl: add logic to issue IBPB on exit to guest Jan Beulich
2023-01-25 21:10   ` Andrew Cooper
2023-01-26  8:02     ` Jan Beulich
2023-01-26 20:27       ` Andrew Cooper
2023-02-06 13:58         ` Jan Beulich
2023-01-25 15:26 ` [PATCH v3 2/4] x86/spec-ctrl: defer context-switch IBPB until guest entry Jan Beulich
2023-01-26 20:43   ` Andrew Cooper
2023-02-06 14:24     ` Jan Beulich
2023-01-25 15:26 ` Jan Beulich [this message]
2023-01-26 20:49   ` [PATCH v3 3/4] x86: limit issuing of IBPB during context switch Andrew Cooper
2023-01-27  7:51     ` Jan Beulich
2023-01-27 17:47       ` Andrew Cooper
2023-02-06 14:58         ` Jan Beulich
2023-01-25 15:27 ` [PATCH v3 4/4] x86/PV: issue branch prediction barrier when switching 64-bit guest to kernel mode Jan Beulich
2023-01-25 17:49 ` [PATCH v3 0/4] x86/spec-ctrl: IPBP improvements Andrew Cooper
2023-01-26  7:32   ` Jan Beulich

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=c39faba2-1ab6-71da-f748-1545aac8290b@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.