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

Re: [PATCH] x86/svm: require VMSAVEvirt for nested virt


  • To: Teddy Astie <teddy.astie@xxxxxxxxxx>, Stephen Cheng (程小枫) <stephen.cheng@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Mon, 27 Jul 2026 12:36:35 +0000
  • Accept-language: en-US
  • 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=arcselector10001; 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=OnpeTxZQBAM5/IHaaPNeleJuM+UxZA8y7dnaefJaTxA=; b=bIQDYjHRYwUin/58+E93FZGJGG1hUUHbqL1LIoEdb701Fce3bJ/hIYyU1ZcxkfZzX4wQqLjXZ4kwXe1+dmzDPHPnGzmezYBmR2U6NmGTZKJJFkHVocnua8bN15ZxWXP53rCltAfOVjytNU7SnBS1GqGkJLHYU7vxTA6uJTO785ctg/xxdR+CxlSdV6/JhVNKk0iysyJ2HCzqSZPt52QraybD60Mcdv5VwNGeLm7Y2qS0ZN7BzO4xtQ0DyK59I0TzvyCzFbYAQ0R/I4V/Cm1tYSkJUuoKGf196WxBfWdg3kizRYYaoy4da1P1RK+zfmvFPZeHTnc+StRkfMOBDNMTZA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FWumqU4LkTG/SvKoalQqU5MS+lgKx+oKcocRHGnK9Kzi4xecwuTRKS2KFsgud7PTb94XhEcCyKTd7QVs9/nJc9YJ6g/pW566q4ou6RGQ5jhZUSBeFpucMrj1tUvwus4oHLxHpjahC3fgvkesB4a/G0KatDxfxTWHH74YdDJx3E9KY+2Pe4NdXOY7Skzx3VwOD60yreUrOYYPhXmeFTNd/QF1Q0eKKdOlnsgux9NGT5FUWh7ZgPmjaur79kf1VVA1pTNifBL7LlTrEz/l2LHDZiTkwfyDQIyQFw/BeveiQQ+k59KLgN+Lfclc3gVFQB/fMTY3iA61BLHfPJJ20doyHQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Mon, 27 Jul 2026 12:36:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHdHZgDgUepMUDe+06Vza+F9KISebaBQH8AgAALr2s=
  • Thread-topic: [PATCH] x86/svm: require VMSAVEvirt for nested virt

> From: Teddy Astie
> Sent: Monday, July 27, 2026 12:48 PM
> To: Stephen Cheng (程小枫); xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Ross Lagerwall; Andrew Cooper; Anthony PERARD; Michal Orzel; Jan Beulich; 
> Julien Grall; Roger Pau Monné; Stefano Stabellini; Jason Andryuk
> Subject: Re: [PATCH] x86/svm: require VMSAVEvirt for nested virt
> 
> 
> Le 27/07/2026 à 09:20, Stephen Cheng a écrit :
> > Virtual VMLOAD/VMSAVE lets an L1 guest execute VMLOAD and VMSAVE
> > without intercepts.  Without it, Xen has to map the L1-provided VMCB
> > and re-execute each instruction in L0, complicating security-sensitive
> > state handling.
> 
> >
> > Make VMSAVEvirt a hard requirement for nested SVM.  Advertise it to
> > L1, enable it when L1 enables SVM, and remove the nested VMLOAD/VMSAVE
> > emulation path.  Any remaining intercept therefore comes from a guest
> > which has not enabled SVM and receives #UD.
> >
> > Assisted-by: Claude:claude-opus-4-8
> > Signed-off-by: Stephen Cheng <stephen.cheng@xxxxxxxxxx>
> > ---
> >   docs/designs/nested-svm-cpu-features.md |  11 +++
> >   xen/arch/x86/cpu-policy.c               |   3 +-
> >   xen/arch/x86/hvm/svm/nestedsvm.c        |  24 ++++--
> >   xen/arch/x86/hvm/svm/svm.c              | 100 +++---------------------
> >   xen/arch/x86/hvm/svm/svm.h              |   2 -
> >   5 files changed, 41 insertions(+), 99 deletions(-)
> >
> > diff --git a/docs/designs/nested-svm-cpu-features.md 
> > b/docs/designs/nested-svm-cpu-features.md
> > index ce168e68e1..798480b259 100644
> > --- a/docs/designs/nested-svm-cpu-features.md
> > +++ b/docs/designs/nested-svm-cpu-features.md
> > @@ -109,3 +109,14 @@ leaf 8000000A:edx
> >     Using it in L0 reduces the chance that we'll make some sort of error
> >     in the decode path.  And if hardware supports it, it's easy enough
> >     to provide to the L1.
> > +
> > +- 15 `VLoadSave` *Virtual VMLOAD/VMSAVE*: Require for L0, provide to L1
> > +
> > +  Without this feature Xen has to intercept the L1 hypervisor's VMLOAD
> > +  and VMSAVE instructions and emulate them by re-executing the real
> > +  instruction on a mapped copy of the L1-supplied VMCB.  That path
> > +  handles a complex, security-sensitive subset of state (the hidden
> > +  segment descriptors for FS/GS/TR/LDTR plus the SYSCALL/SYSENTER
> > +  MSRs), so on faithfulness grounds we'd much rather let the hardware
> > +  do it.  When present, the instructions execute natively in the guest
> > +  without a #VMEXIT, which is both simpler and faster.
> 
> I'm not convinced making "VMSAVEvirt" mandatory is a good idea, in
> particular, there is a errata (1454 - Processor May Log Unexpected LS
> MCE Error When Executing Virtualized VMLOAD or Virtualized VMSAVE) on
> Family 19h regarding this feature.
> 
> Had you considered improving the current implementation of virtualized
> VMLOAD/VMSAVE ? AIUI, the way Xen currently implements this instruction
> (by mapping the L1 VMCB then calling vmload/vmsave on it) is more of a
> implementation choice than a requirement.
> 
> A better (at least, likely safer) way to emulate such instructions (and
> not relying on VMSAVEvirt) would be to copy parts of L1 VMCB from/to L0
> VMCB and let Xen perform the appropriate vmload/vmsave on its own VMCBs
> as usual.
> 

Given the limited resources we have to try to make nested virt functional and
eventually production ready, I think any time spent making it work on older
processors and then testing it is a waste. AMD nested virt doesn't work now so
removing support for older processors is not a regression in functionality.

Ross

 


Rackspace

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