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

Re: [PATCH 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Mon, 14 Feb 2022 20:46:50 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=n+xWnoUlh9HhJ3fEOyjvhXYRWmXKU2+lJ/KUpHfQ6/g=; b=Mw5kFr2F5uFcyOdBwqQ2L75jjYEafGsBa1xeQ2KMhf2j7SRLRC5RJvR51mnwoCH2UMVP5CHKY/bpjTNhPVSRZoMTnvUNULdTaiVitNk0Irofzqw3KbdWWPGixrY3ClLpSZSeceNVdDNWM+KUvGUhZZ3SVnSfOxM1i9lq1+wA0pffcifhtPmTCCkK5t111Hrntf5xQLQ+QfElex03y+n+UcYJCuJUDU9+sQB8ByoQSSgtHuFEYIZMU8kFLFrl0XmN8efgNO5HegZu4oGnfVejLAJ8KA+hXcs5e8d3J1Kfw2Z9HwZeouF6yRWj4E4NKc+VfEafD4eMLBNXsdO+6rvt9Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lMgwoSPPev/ih3XYABGdPfxyFL5M1918941WpFKWtl4mcRiWxykyYUyu748FVDSddwUvZAJY9040Yspl7n/UZoJK42zKotf7bf7Lvjfcle1FPZaQOhkCygTolqSlmgLiXZmY2qfpWFdP3EZiBNWXnhjG8Txoz+43VATs8jCrENbmoCvqDXtIP9vktPnGAhsT+lvPm72dj88LCbrB5wr3oZ2KlrhS1qjMw32/wf9PdeKEdrrNOzkbHrL2kvZJxBMnjvi4kmRxKgweAWVck4oVnKHoidMXcDtkq7BTEo1AUGTKnJ+l+yfHeJiaIocAd+/v1Y45kdAAV0F2NzX8NpG8sQ==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 14 Feb 2022 20:47:19 +0000
  • Ironport-data: A9a23:EWqY4Ku2FHaxDuuA5XcAg9AqF+fnVKpZMUV32f8akzHdYApBsoF/q tZmKT3QP/zYNmKne9x1Oo209B9U6J/cxoViSQJp/iwyFSoR+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZQP0VOZigHtIQMsadUsxKbVIiGHdJZS5LwbZj2NYy2IThWWthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Npl7IaCVFZ3IqH1l8sQbRJZKSpuNK8a9+qSSZS/mZT7I0zudnLtx7NlDV0sPJ1e8eFyaY1M3 aVGcnZXNEnF3r/ohuLgIgVvrp1LwM3DFYUToHx/ixreCu4rW8vrSKTW/95Imjw3g6iiGN6AO ZZAOWI0NXwsZTUUGUg9T4hhvt6om0fPWCRdhmKLvqwetj27IAtZj+G2bYu9lsaxbd5Ogk+Sq 2bC/mL4KhIXLtqSzXyC6H3ErvDLtTP2XsQVDrLQ3vx3hFyewEQDBRtQUkG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NL9V00zEX/kB9WHVpm5Oj+f xGzc516farslossSkb6Ky90KnpewK5yXbsibNhfItKLzOWx1dAS7sSrbcKogeQVREWk9Q96U 4OSdkHNDSdNykZsS++2njELz9C+qjFzEnLv5ak854Fd2gDAMsMj3YbNu/YKDwNeOAvP+tlKH P23Lshm9PUQwVvUi3NPAhiYwGsnayvqLvWJTo9QzI34giHij2lrJTgFQKD4xsYWzRThZ8/7G nsiWXCl+eemsD+7iWZ+37Y7pxQltek4MBEHtawhs8cLSipohq0Zb5mR6aJsFkO0aSSARcR4Z 3xSiUbToJOAkDqDziISNzWqlHdOQMVmjjfIJmj8CDeSILCNWgH4oF69Pxkm1PimjsdVZdHof 52Niuixulq5VmrplWM2/HYEx5tjUa6unwkjKoaiGFeS5IXbPtLoZUY5149KuZMIMvW0vFtLA BVNrCX2B+WSyLsU1nJ+m10hNC8VHU6GRmLBkAEp8yOyjBT2HR01VERysATlmoJsMtVcegK28 3UdqBz0L1eRM4faqxwQO8HXMusE2TIBRbBKnibL1jrHLwOf3jNt5n06rMo4/zCQu1F8LIi3J DaFF9Iv287fEzjTcWIwZ1Q6xjIBH6wWDz8o/sur6SReoeMDYYDHRfzPWzGovHQ1cn3WPerKc pbEKgmd8PeEQ==
  • Ironport-sdr: /WxbFVkmZxQI759Z3mJhL164W/hao9IRZsk42iAJXTgtmNZgasIi1uSXpLHPv0FZmUMLn+BNRz h+SscJGXqF2XS3M73/2OzSwNDPCV2HKfkZKUQn6Lo4Uehc1TWI0lh1+jYa7WQrVzaLP0CQD929 FjpuK/kSIRMaKSolh2MNg1oJvjTM238BENDeARNdEmRPtO1vgycUQW+HUZ5UefGaJpz45clRvo eYFxeLpR7xjfcZhYqVwRV9p5TTtvCB7O3GpUXjKqDepERjMzNQBTUte2iRPQvFUGx6pFqDR3Wa 2tgNxJiv9a70JSxZJbhv0vxN
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYF4thsK6t/XxLoUS9M7m4X3UCsayTmOKA
  • Thread-topic: [PATCH 0/3] amd/msr: implement MSR_VIRT_SPEC_CTRL for HVM guests

On 01/02/2022 16:46, Roger Pau Monne wrote:
> Hello,
>
> The following series implements support for MSR_VIRT_SPEC_CTRL on
> different AMD CPU families.
>
> Note that the support is added backwards, starting with the newer CPUs
> that support MSR_SPEC_CTRL and moving to the older ones either using
> MSR_VIRT_SPEC_CTRL or the SSBD bit in LS_CFG.
>
> First patch is quite clean, as it uses the shadow SPEC_CTRL in order to
> set the SSBD bit and have it context switched by Xen using the existing
> logic recently added.
>
> The next two patches introduce a different way to context switch SSBD
> either depending on the underlying SSBD support, so it's either using
> VIRT_SPEC_CTRL or the LS_CFG MSR. They also kind of overload the usage of
> several spec_ctrl variables in the hypervisor in order to store the
> status of SSBD even when not using MSR_SPEC_CTRL itself. I've tried to
> document those in the commit messages, but it could be controversial.
>
> Thanks, Roger.

I suspect it would help reviewing things to state what the end result is
intended to be.

1) Xen should use the AMD provided algorithm for engaging SSBD itself. 
This includes using MSR_VIRT_SPEC_CTRL if Xen is nested under another
hypervisor.  In the current code, this is implemented by amd_init_ssbd()
even if only limited to boot paths for simplicity.

2) On Fam15h thru Zen1, Xen should expose MSR_VIRT_SPEC_CTRL to guests
by default to abstract away the model and/or hypervisor specific
differences away in MSR_LS_CFG/MSR_VIRT_SPEC_CTRL.

3) On Zen2 and later, MSR_SPEC_CTRL exists and should be used in
preference.  However, for migration compatibility, Xen should be capable
of offering MSR_VIRT_SPEC_CTRL to guests (max, not default) implemented
in terms of MSR_SPEC_CTRL.

This way, a VM levelled to run on Zen1 and Zen2 sees MSR_VIRT_SPEC_CTRL
and can use it on both hosts, whereas a VM only intending to run on Zen2
gets MSR_SPEC_CTRL by default.

Obviously this means that a VM on Zen2 can opt in to MSR_VIRT_SPEC_CTRL
because of how max vs default works and this is a legal configuration,
even if it's not one you'd expect to see outside of testing scenarios.

~Andrew

 


Rackspace

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