Re: [PATCH v6 02/25] x86/fpu/xstate: Fix guest fpstate allocation size calculation

From: Yang, Weijiang
Date: Thu Sep 14 2023 - 22:46:14 EST


On 9/15/2023 6:45 AM, Edgecombe, Rick P wrote:
On Thu, 2023-09-14 at 02:33 -0400, Yang Weijiang wrote:
Fix guest xsave area allocation size from fpu_user_cfg.default_size
to
fpu_kernel_cfg.default_size so that the xsave area size is consistent
with fpstate->size set in __fpstate_reset().

With the fix, guest fpstate size is sufficient for KVM supported
guest
xfeatures.

Signed-off-by: Yang Weijiang <weijiang.yang@xxxxxxxxx>
There is no fix (Fixes: ...) here, right?

Ooh, I got it lost during rebase, thanks!

I think this change is needed
to make sure KVM guests can support supervisor features. But KVM CET
support (to follow in future patches) will be the first one, right?

Exactly, the existing code takes only user xfeatures into account, and we have more
and more CPU features rely on supervisor xstates.

The side effect will be that KVM guest FPUs now get guaranteed room for
PASID as well as CET. I think I remember you mentioned that due to
alignment requirements, there shouldn't usually be any size change
though?

Yes, IIUC the precondition is AMX feature is enabled for guest so that the CET supervisor
state actually resides in the gap to next 64byte aligned address, so no actual size expansion.

It might be nice to add that in the log, if I'm remembering
correctly.

Sure, thanks!