[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aDjKpsD8PTugB0+Q@AUSJOHALLEN.amd.com>
Date: Thu, 29 May 2025 15:59:18 -0500
From: John Allen <john.allen@....com>
To: Chao Gao <chao.gao@...el.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
tglx@...utronix.de, dave.hansen@...el.com, seanjc@...gle.com,
pbonzini@...hat.com, peterz@...radead.org,
rick.p.edgecombe@...el.com, weijiang.yang@...el.com, bp@...en8.de,
chang.seok.bae@...el.com, xin3.li@...el.com,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>,
Maxim Levitsky <mlevitsk@...hat.com>,
Mitchell Levy <levymitchell0@...il.com>,
Kees Cook <kees@...nel.org>, Stanislav Spassov <stanspas@...zon.de>,
Eric Biggers <ebiggers@...gle.com>, Oleg Nesterov <oleg@...hat.com>,
Nikolay Borisov <nik.borisov@...e.com>,
Vignesh Balasubramanian <vigbalas@....com>
Subject: Re: [PATCH v8 1/6] x86/fpu/xstate: Differentiate default features
for host and guest FPUs
On Thu, May 22, 2025 at 08:10:04AM -0700, Chao Gao wrote:
> Currently, guest and host FPUs share the same default features. However,
> the CET supervisor xstate is the first feature that needs to be enabled
> exclusively for guest FPUs. Enabling it for host FPUs leads to a waste of
> 24 bytes in the XSAVE buffer.
>
> To support "guest-only" features, add a new structure to hold the
> default features and sizes for guest FPUs to clearly differentiate them
> from those for host FPUs.
>
> Add two helpers to provide the default feature masks for guest and host
> FPUs. Default features are derived by applying the masks to the maximum
> supported features.
>
> Note that,
> 1) for now, guest_default_mask() and host_default_mask() are identical.
> This will change in a follow-up patch once guest permissions, default
> xfeatures, and fpstate size are all converted to use the guest defaults.
>
> 2) only supervisor features will diverge between guest FPUs and host
> FPUs, while user features will remain the same [1][2]. So, the new
> vcpu_fpu_config struct does not include default user features and size
> for the UABI buffer.
>
> An alternative approach is adding a guest_only_xfeatures member to
> fpu_kernel_cfg and adding two helper functions to calculate the guest
> default xfeatures and size. However, calculating these defaults at runtime
> would introduce unnecessary overhead.
>
> Suggested-by: Chang S. Bae <chang.seok.bae@...el.com>
> Suggested-by: Sean Christopherson <seanjc@...gle.com>
> Signed-off-by: Chao Gao <chao.gao@...el.com>
Reviewed-by: John Allen <john.allen@....com>
Powered by blists - more mailing lists