On 4/27/2025 8:26 PM, Chao Gao wrote:
For KVM, it's just the one MSR, and KVM needs to support save/restore of that MSR
no matter what, so supporting it via XSAVE would be more work, a bit sketchy, and
create yet another way for userspace to do weird things when saving/restoring vCPU
state.
Agreed. One more issue of including CET_S into KVM_GET/SET_XSAVE{2} is:
XSAVE UABI buffers adhere to the standard format defined by the SDM, which
never includes supervisor states. Attempting to incorporate supervisor states
into UABI buffers would lead to many issues, such as deviating from the
standard format and the need to define offsets for each supervisor state.
Good point.
FRED RSPs are in the supervisor state and are not defined within the
XSAVE area. Their save/restore operations need to be explicitly added
one by one.
Would it be sensible to introduce a KVM supervisor MSR state that
includes new MSRs?
This approach is similar to what KVM has with its CPUID API, allowing
batch MSR set/get operations and improving MSR code sharing. Since the
FRED state is entirely defined in MSRs (except for CR4.FRED), this
should simplify the context save and restore for FRED.
Thanks!
Xin