On 1/18/22 17:53, Sean Christopherson wrote:
and I think we should redo all or most of kvm_update_cpuid_runtime
the same way.
Please no. xstate_required_size() requires multiple host CPUID calls, and glibc
does CPUID.0xD.0x0 and CPUID.0xD.0x1 as part of its initialization, i.e. launching
a new userspace process in the guest will see additional performance overhread due
to KVM dynamically computing the XSAVE size instead of caching it based on vCPU
state. Nested virtualization would be especially painful as every one of those
"host" CPUID invocations will trigger and exit from L1=>L0.
Agreed, but all of the required data is by Linux cached in
xstate_offsets, xstate_sizes and xstate_comp_offsets; moving
xstate_required_size to xstate.c and skipping the host CPUID would
probably be a good idea nevertheless.
Paolo