]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: nVMX: Switch to vmcs01 to update PML controls on-demand if L2 is active
authorSean Christopherson <seanjc@google.com>
Fri, 9 Jan 2026 03:45:26 +0000 (19:45 -0800)
committerSean Christopherson <seanjc@google.com>
Wed, 14 Jan 2026 01:35:31 +0000 (17:35 -0800)
commit3e013d0a70994df2c2ba78d599a6c039ab0977a5
treeae6f46f4a370e76e51b5d4ade57b7c144aa91cb6
parentc3a9a27c79e4e5d8bdb20a26d16230111207e98e
KVM: nVMX: Switch to vmcs01 to update PML controls on-demand if L2 is active

If KVM toggles "CPU dirty logging", a.k.a. Page-Modification Logging (PML),
while L2 is active, temporarily load vmcs01 and immediately update the
relevant controls instead of deferring the update until the next nested
VM-Exit.  For PML, deferring the update is relatively straightforward, but
for several APICv related updates, deferring updates creates ordering and
state consistency problems, e.g. KVM at-large thinks APICv is enabled, but
vmcs01 is still running with stale (and effectively unknown) state.

Convert PML first precisely because it's the simplest case to handle: if
something is broken with the vmcs01 <=> vmcs02 dance, then hopefully bugs
will bisect here.

Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://patch.msgid.link/20260109034532.1012993-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h