[PATCH for-4.17 v4 0/2] amd/virt_ssbd: refactoring and fixes

Roger Pau Monne posted 2 patches 3 weeks, 2 days ago
Failed in applying to current master (apply log)
docs/misc/xen-command-line.pandoc      | 10 +++--
xen/arch/x86/cpu/amd.c                 | 56 ++++++++++++++------------
xen/arch/x86/cpuid.c                   |  9 +++--
xen/arch/x86/hvm/svm/entry.S           |  6 ---
xen/arch/x86/hvm/svm/svm.c             | 45 ++++++++-------------
xen/arch/x86/include/asm/amd.h         |  1 +
xen/arch/x86/include/asm/cpufeatures.h |  2 +-
xen/arch/x86/include/asm/msr.h         |  3 +-
xen/arch/x86/msr.c                     |  9 +++++
xen/arch/x86/spec_ctrl.c               |  8 ++--
10 files changed, 75 insertions(+), 74 deletions(-)
[PATCH for-4.17 v4 0/2] amd/virt_ssbd: refactoring and fixes
Posted by Roger Pau Monne 3 weeks, 2 days ago
Hello,

Just two patches remaining, and the last one is already Acked.

First patch deals with moving the switching of SSBD from guest
vm{entry,exit} to vCPU context switch, and lets Xen run with the guest
SSBD selection under some circumstances by default.

Andrew has expressed reservations to me privately with patch 2/2, but
I'm still sending it so that comments can be made publicly (or the patch
applied).

Thanks, Roger.

Roger Pau Monne (2):
  amd/virt_ssbd: set SSBD at vCPU context switch
  amd: remove VIRT_SC_MSR_HVM synthetic feature

 docs/misc/xen-command-line.pandoc      | 10 +++--
 xen/arch/x86/cpu/amd.c                 | 56 ++++++++++++++------------
 xen/arch/x86/cpuid.c                   |  9 +++--
 xen/arch/x86/hvm/svm/entry.S           |  6 ---
 xen/arch/x86/hvm/svm/svm.c             | 45 ++++++++-------------
 xen/arch/x86/include/asm/amd.h         |  1 +
 xen/arch/x86/include/asm/cpufeatures.h |  2 +-
 xen/arch/x86/include/asm/msr.h         |  3 +-
 xen/arch/x86/msr.c                     |  9 +++++
 xen/arch/x86/spec_ctrl.c               |  8 ++--
 10 files changed, 75 insertions(+), 74 deletions(-)

-- 
2.37.3
Re: [PATCH for-4.17 v4 0/2] amd/virt_ssbd: refactoring and fixes
Posted by Andrew Cooper 3 weeks, 1 day ago
On 15/11/2022 13:26, Roger Pau Monne wrote:
> Hello,
>
> Just two patches remaining, and the last one is already Acked.
>
> First patch deals with moving the switching of SSBD from guest
> vm{entry,exit} to vCPU context switch, and lets Xen run with the guest
> SSBD selection under some circumstances by default.
>
> Andrew has expressed reservations to me privately with patch 2/2, but
> I'm still sending it so that comments can be made publicly (or the patch
> applied).
>
> Thanks, Roger.

To avoid a further round trip, I've committed these patches with some
minor non-functional adjustments.  In patch 1, an expanded context
switching comment, and in patch 2, an adjusted commit message and
movement into __initdata.

I've also closed out #90, which closes one of the release blockers.

All other bugs can wait until 4.18, including the totally bizarre one
where using cpuid="host:virt-ssbd=1" in the xl.cfg file causes IBRS to
become hidden.  I confirmed this was pre-existing behaviour, but haven't
investigated further.

~Andrew
Re: [PATCH for-4.17 v4 0/2] amd/virt_ssbd: refactoring and fixes
Posted by Roger Pau Monné 3 weeks, 1 day ago
On Wed, Nov 16, 2022 at 12:27:29AM +0000, Andrew Cooper wrote:
> On 15/11/2022 13:26, Roger Pau Monne wrote:
> > Hello,
> >
> > Just two patches remaining, and the last one is already Acked.
> >
> > First patch deals with moving the switching of SSBD from guest
> > vm{entry,exit} to vCPU context switch, and lets Xen run with the guest
> > SSBD selection under some circumstances by default.
> >
> > Andrew has expressed reservations to me privately with patch 2/2, but
> > I'm still sending it so that comments can be made publicly (or the patch
> > applied).
> >
> > Thanks, Roger.
> 
> To avoid a further round trip, I've committed these patches with some
> minor non-functional adjustments.  In patch 1, an expanded context
> switching comment, and in patch 2, an adjusted commit message and
> movement into __initdata.

FWIW, I didn't expand the comment in patch 1 because I though it was
likely to get out of sync.

> I've also closed out #90, which closes one of the release blockers.
> 
> All other bugs can wait until 4.18, including the totally bizarre one
> where using cpuid="host:virt-ssbd=1" in the xl.cfg file causes IBRS to
> become hidden.  I confirmed this was pre-existing behaviour, but haven't
> investigated further.

Hm, I don't seem to be able to use cpuid="host:virt-ssbd=1", I get:

# xl create -c tests/virt-spec/test-hvm32-virt-spec.cfg
Parsing config from tests/virt-spec/test-hvm32-virt-spec.cfg
while parsing CPUID string: "host:virt-ssbd=1":
  error: first word must be "host"

However using
cpuid=["0x80000008:ebx=xxxxxx1xxxxxxxxxxxxxxxxxxxxxxxxx"] does work
and I can see both virt-ssbd and ibrs present in the guest CPUID on an
EPYC 7543P (Milan).

Regards, Roger.