On Thu, Feb 12, 2026 at 07:58:55AM -0800, Jim Mattson wrote: > When nested NPT is enabled and KVM_SET_NESTED_STATE is used to restore an > old checkpoint (without a valid gPAT), the current IA32_PAT value must be > used as L2's gPAT. > > Unfortunately, checkpoint restore is non-atomic, and the order in which > state components are restored is not specified. Hence, the current IA32_PAT > value may be restored by KVM_SET_MSRS after KVM_SET_NESTED_STATE. To > further complicate matters, there may be a KVM_GET_NESTED_STATE before the > next KVM_RUN. > > Introduce a new boolean, svm->nested.legacy_gpat_semantics. When set, hPAT > updates are also applied to gPAT, preserving the old behavior (i.e. L2 > shares L1's PAT). Set this boolean when restoring legacy state (i.e. nested > NPT is enabled, but no GPAT is provided) in KVM_SET_NESTED_STATE. Clear > this boolean in svm_vcpu_pre_run(), to ensure that hPAT and gPAT are > decoupled before the vCPU resumes execution. > > Signed-off-by: Jim Mattson <[email protected]>
Reviewed-by: Yosry Ahmed <[email protected]>

