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

Re: [PATCH 2/9] x86emul: support WRMSRNS


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 5 Apr 2023 22:29:53 +0100
  • 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=0SmF1t85NoXdJcE5Z7Mh+1yNn5WUeBPvZXB5ZnLGE/I=; b=a7Po7biwbrjOZ+rIvS/bK+ti4/m2DNSmxvdXeHm3bySw9w2hzU7hYB+pXWeVTUVAi3fHVvAtwNfKqcH2COkEohOeGg3MTFpAGiSJYEGrr0aWJT4fDpOTnqDi0kNMognAKrJ5R1xjzpPLa9N5qNsV3/0hv/sOvNIdwr79FZLjL7q/KlBj4grb266GwAhfm2CicJ5lg+SuHK/2U5604OuvfIrIcBdRQGmTlsouCnPy+IZ93LIEGTIBYrVi96aK/uvCdejOabu02wM6UIoOXPrRozongVFvw3w615jt0hs4cPuAZwMBK98ZR6QTMz1v0kbal+Zfy+WnZpncr1dmUVnGvw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aYGOxAOOWHIdvloJefrYBtaAhHuXf8l7JYgFSyTm/yiCsBdl3uEnls+Ev3v7y8MpK+7TTmph4uJOIz4cLg4d2I4Uts0YHGLNLIofw8mHdC6bx3qZ1nhsOhfZrVKgHCS5LwTVlVlohvwizQzCvpXXqSC2DhrU5F4G04TJxcx9ZCldCaUHsqAtrMsE1S0rpc3u2sdEo6u1bZjqh+PH5kwwJ5KxdEdgdLYSSs4491GSqNGSkqU5+0EfzJq99yvBHUiRGmVam9tc8rZlWK35KCOdVsIS2pBUr34J4kP+oDUzOHLGcFWwuyibZ7HlZd/L5Im0t1jwjB8UYyJKmGgnus2aKA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 05 Apr 2023 21:30:18 +0000
  • Ironport-data: A9a23:jbOo+KA9mGO32RVW/wviw5YqxClBgxIJ4kV8jS/XYbTApDwj1zNVm 2VOXGuGOa3fNGSgftxxPIS/p09QuZDQy9FqQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nOHuGmYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFu8pvlDs15K6p4G9A4wRlDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw2918I0hPz dckCjE9U0+jlqWY3qyaVbw57igjBJGD0II3nFhFlWucNtB/BJfJTuPN+MNS2yo2ioZWB/HCa sEFaD1pKhPdfxlIPVRRA5U79AuqriCnL3sE9xTI+uxrswA/zyQouFTpGPPTdsaHWoN+mUGAq 3id12/4HgsbJJqUzj/tHneE37eUx32qCN9JfFG+3vpj3VOtxVVUMzk1el258d6rqk35BPsKf iT4/QJr98De7neDTNPwQhm5q36spQMHVpxbFOhSwBGAzO/Y7hiUAkAATyVdc5o2uckuXzso2 1SV2dTzClRHr7m9WX+bsLCOoluP1TM9KGYDYWofS1ID6ty7+oUr1EqTHpBkDbK/icDzFXfo2 TeWoSMihrIVy8kWy6G8+lOBiDWpznTUcjMICszsdjrNxmtEiESNPuRENXCzAS58Ebuk
  • Ironport-hdrordr: A9a23:vta1F6FCXnJz1zInpLqE+ceALOsnbusQ8zAXPiFKOH5om6mj/f xG88536faZslossQgb6LW90cq7MBDhHPxOgLX5VI3KNGLbUQ2TQ72KhrGD/9SPIUPDytI=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04/04/2023 3:50 pm, Jan Beulich wrote:
> This insn differs from WRMSR solely in the lack of serialization. Hence
> the code used there can simply be used here as well, plus a feature
> check of course.

I have a feeling this is a bit stale now that 0f01.c has moved into a
separate file ?

>  As there's no other infrastructure needed beyond
> permitting the insn for PV privileged-op emulation (in particular no
> separate new VMEXIT) we can expose the insn to guests right away.

There are good reasons not to expose this to PV guests.

The #GP fault to trigger emulation is serialising, so from the guest's
point of view there is literally no difference between WRMSR and WRMSRNS.

All code is going to need to default to WRMSR for compatibility reasons,
so not advertising WRMSRNS will save the guest going through and
self-modifying itself to use a "more efficient" instruction which is not
actually more efficient.


But, in general and as said before, I feel it is irresponsible to be
continuing to add slow guest-fastpaths without introducing a real fastpath.

We desperately need HYPERCALL_pv_priv_op which can take an array of
inputs, and has an sub-op for each of CPUID, RDMSR, WRMSR and whatever
other ops are trapping because of no fastpath.  Perf testing routinely
shows that #GP/#UD faults are only 2 orders of magnitude less rare in PV
guests than #PF, which is an insane wastage when guests are supposed to
be enlightened and use fastpaths in the first place.


The emulation implementation is fine, so Reviewed-by: Andrew Cooper
<andrew.cooper3@xxxxxxxxxx> but dependent on the PV guest changes being
dropped.

~Andrew



 


Rackspace

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