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

Re: [PATCH v2] x86/PV: issue branch prediction barrier when switching 64-bit guest to kernel mode


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 13 Sep 2022 17:41:12 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=uiGZopffOrsqHm6hSKlZXobArX9sGqYV8e5b0TiaAT8=; b=IjtIwsqKiB7PLB1n738Y5A/2tANL/auiowlU0I1CQwuCoTZcfzKbIQDIxEz5FtUfguXG7PfsE3qXeBVyYtzv3D3JZhXWyoy19I6mgp0lojeKGbJfTu66/V6Jee6kT3JIU0WgvqVY5mOMF/8S1zdD3faQjNeTXBL7xFiLnabpGnvHq0Ma6rvkP/n4wHa8XB8EjvttD4AeDcUxRj3g27Seuia6v5wYM2QSZFhbQ5hG81lkU7NweLCQlCZY37EXUToTPd8p/9Tc5yx74NweZgOCBBLiEQ/axNF/EVKwijTXQ6LIHaMDhoPyTcXXTCCr5U/HB56IdpYU6iTKA5ZY5VdEjw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EruD3GtNEKiKgI6ZaVfzuF0c/KPM4ye35EuSprgL7pe0Em3rAoSSO5DP4Tontn1pQaJAosg/VPFoEgnZ4pkwdFyFGxY99s+NEVMZ/7fy7VwQD3J/Ig/1ekugLsng++EyIQcLRD4PXVTcRaBgXyGpexEEuGCOqasPqG0hVzpYURRW5rZEPySnq+6c9QKQeYyXrKWGTKP+Ozsv+kvz36c+dB2cCnHs8TNq+swlSd3IylXqySlpwrhs7MgZAHcxcZa7QSu4CvqbKX5Q5kwXzHum8fopqLbBssUzOcIEW56NcDg0VVf6Ty16gzwTKhgNaNISgm60ekF5sLKqy7frpGV5+Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 13 Sep 2022 15:41:53 +0000
  • Ironport-data: A9a23:VwOXWKsAWTEq32uj8bTtA45Yu+fnVERfMUV32f8akzHdYApBsoF/q tZmKW6OM/yNYGDxKd50OYqz9UpX75TXmNBhSABtrngxFi9G+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/vOHtIQMcacUghpXwhoVSw9vhxqnu89k+ZAjMOwRgiAo rsemeWGULOe82MyYzl8B56r8ks15qyj4WhA5DTSWNgQ1LPgvyhNZH4gDfnZw0vQGuF8AuO8T uDf+7C1lkuxE8AFU47Nfh7TKyXmc5aKVeS8oiM+t5uK23CukhcawKcjXMfwXG8M49m/c3Kd/ /0W3XC4YV9B0qQhA43xWTEAe811FfUuFLMqvRFTGCFcpqHLWyKE/hlgMK05FYYb9PR0Xntqz P0JJig8a0uAqcip/b3uH4GAhux7RCXqFKU2nyg5iBv/XbMhS52FRLjW79hF2jt2ntpJAfvVe 8seb3xocQjEZBpMfFwQDfrSns/x3iW5L2Ie9QLT/PRni4TQ5FUZPLzFKt3ad8bMXcxItk2Zu njH7yLyBRRy2Nm3mWDUqCP02LWncSXTetkuCLqbq/RTpliQmGIiFEcuZ2WBrqzs4qK5c5cFQ 6AOwQIsp6Uv8E2gTvHmQga15nWDu3Y0S9dWVuE39gyJ4q7V+BqCQHgJSCZbb94rv9NwQiYlv neWm/v5CDopt6eaIU9x7Z+RpDK2fCITfWkLYHZdSRNfuoez5oYukhjIU9BvVravicH4Ei3xx DbMqzUig7IUjogA0KDTEU37vg9Ab6PhFmYdjjg7lEr/hu+lTOZJv7CV1GU=
  • Ironport-hdrordr: A9a23:xK0xeqG9RymDbmxwpLqFDZHXdLJyesId70hD6qkvc3Fom52j/f xGws5x6faVslkssb8b6LW90Y27MAvhHP9OkPAs1NKZMDUO11HJEGgP1/qA/9SkIVyEygc/79 YdT0EdMqyWMbESt6+TjmiF+pQbsb+6GciT9JrjJhxWPGVXgs9bnmVE4lHxKDwNeOAKP+tPKL Osou584xawc3Ueacq2QlEDQuj4vtXO0LbrewQPCRIL4BSHyWrA0s+yLzGomjMlFx9fy7Yr9m bI1yT/+6WYqvm+jjvRzXXa4Zh6kMbojvFDGMuPoM4ILSiEsHffWK1RH5m5+BwlquCm71gn1P HKvhcbJsx2r0jce2mkyCGdqTXI4XIL0TvP2FWYiXzsrYjSXzQhEfdMgopfb1/w91cglMsU6t MH40up875sST/QliX04NbFEztwkFCvnHYkmekPy1RCTIolbqNLp4B3xjIeLH45JlO01GkbKp ghMCmFj8wmMG9yLkqp9VWH+ebcEkjaRXy9Mwg/Us/86UkkoJk29Tpa+CUlpAZwyHsMceg62w 36CNUXqFhvdL5iUUsvPpZ0feKHTkrwfDnrDEW+ZXzaKYBvAQO8l3ew2sR82N2X
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jul 19, 2022 at 02:55:17PM +0200, Jan Beulich wrote:
> Since both kernel and user mode run in ring 3, they run in the same
> "predictor mode". While the kernel could take care of this itself, doing
> so would be yet another item distinguishing PV from native. Additionally
> we're in a much better position to issue the barrier command, and we can
> save a #GP (for privileged instruction emulation) this way.
> 
> To allow to recover performance, introduce a new VM assist allowing the guest
> kernel to suppress this barrier.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> v2: Leverage entry-IBPB. Add VM assist. Re-base.
> ---
> I'm not entirely happy with re-using opt_ibpb_ctxt_switch here (it's a
> mode switch after all, but v1 used opt_ibpb here), but it also didn't
> seem very reasonable to introduce yet another command line option. The
> only feasible alternative I would see is to check the CPUID bits directly.

Likely needs a mention in xen-command-line.md that the `ibpb` option
also controls whether a barrier is executed by Xen in PV vCPU context
switches from user-space to kernel.  The current text only mentions
vCPU context switches.

The rest LGTM.

Thanks, Roger.



 


Rackspace

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