All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <amc96@srcf.net>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v3 2/4] x86/spec-ctrl: defer context-switch IBPB until guest entry
Date: Mon, 6 Feb 2023 15:24:56 +0100	[thread overview]
Message-ID: <15cdfa52-03fb-0052-4389-0781422b37f2@suse.com> (raw)
In-Reply-To: <8b4c6aa8-cdc5-50a3-2170-f4af80fe1a26@srcf.net>

On 26.01.2023 21:43, Andrew Cooper wrote:
> On 25/01/2023 3:26 pm, Jan Beulich wrote:
>> In order to avoid clobbering Xen's own predictions, defer the barrier as
>> much as possible.
> 
> I can't actually think of a case where this matters.  We've done a
> reasonable amount of work to get rid of indirect branches, and rets were
> already immaterial because of the reset_stack_and_jump().
> 
> What I'm trying to figure out is whether this ends up hurting us.  If
> there was an indirect call we used reliably pre and post context switch,
> that changed target based on the guest type, then we'd now retain and
> use the bad prediction.

Hmm, so far I was understanding that the context switch operation is
solely for guests' purposes; this looks to be supported by the comments
there. If we were worried about Xen itself here (which of course is a
valid concern), then I think that together with the issue you've
spotted in patch 3 all I can do is drop the two middle patches (and
the HVM part of patch 1). At which point ...

>>  Merely mark the CPU as needing a barrier issued the
>> next time we're exiting to guest context.
>>
>> Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> I couldn't find any sensible (central/unique) place where to move the
>> comment which is being deleted alongside spec_ctrl_new_guest_context().
> 
> Given this, I'm wondering whether in patch 1, it might be better to name
> the new bit SCF_new_guest_context.  Or new_pred_context context (which
> on consideration, I think is better than the current name)?
> 
> This would have a knock-on effect on the feature names, which I think is
> important because I think you've got a subtle bug in patch 3.

... this renaming, which I've done already, may have been in vein.

Jan


  reply	other threads:[~2023-02-06 14:25 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 [this message]
2023-01-25 15:26 ` [PATCH v3 3/4] x86: limit issuing of IBPB during context switch Jan Beulich
2023-01-26 20:49   ` 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=15cdfa52-03fb-0052-4389-0781422b37f2@suse.com \
    --to=jbeulich@suse.com \
    --cc=amc96@srcf.net \
    --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.