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

Re: [PATCH v3 2/4] x86/spec-ctrl: defer context-switch IBPB until guest entry


  • To: Andrew Cooper <amc96@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 6 Feb 2023 15:24:56 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Kwojmc3mZz6Ur7EYL7dib+qQAccTGS5ed5qfQSWcpw4=; b=HQzRA4dSelBeReAYWMw++khUBtTtmQ0ttFF1pvfX0aCxH2GmL3r0KO9UudGzJO2w1ZVNl3fDKyjVYuyWFJjEbflltp74TY8qY2MoBVGFnnFSHcdoZM3sjnK5rC+yfMTgb43xfkOeYhv7AKVpGsAZoezNj621aamrgDixR/DDdSJPRCDlEDSF3LwEOpAljEM56jBhOVBccd1qOQSzg6bP9KwTdVgU7siyJ32V29Qw0jhi8trOAN9luVjB0axr6I5eWA6GTHd+X9Yl9YsQH9sdb5LhGe8SQ0tk2aQIwCAlHiHktbeTIB87A5Pe+mEKq7wgBYvwd4Xlz8RKOrDOc4w8YQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZaOuV/+SiSQlhomcSrrllEIUdpPm5G1RsL9G2yd6jQI1YKvbQfWSz1kl7pNU4JzQQssxT5jqSLYLPPuqb2DhNOVYM1mXe1h8tSDwfA9ojHyPb6KESfwhZxUBwdOZ6yrhHqLp2loOBNM+gv4XFSxOIpMfgcL1DC1Y0ZamQpVrsq8nRcfSORqVfA1IsJgoaqESckhFRaCB/pHTBBmjqV12c21uNSuzp43ww1LHJyT1zEGd8beYYWDikm4A3urwTs98RMfeQEStYa3gJtA9xVO1YfhokZWcN/KXW+fmMAHTEkTUv3KtHzdaAUeFUHckeQ2IApS+Dtmft8iCh1p/UKsavw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 06 Feb 2023 14:25:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> 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



 


Rackspace

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