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

If APICv is (un)inhibited while L2 is running, temporarily load vmcs01 and
immediately refresh the APICv controls in vmcs01 instead of deferring the
update until the next nested VM-Exit.  This all but eliminates potential
ordering issues due to vmcs01 not being synchronized with
kvm_lapic.apicv_active, e.g. where KVM _thinks_ it refreshed APICv, but
vmcs01 still contains stale state.

Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://patch.msgid.link/20260109034532.1012993-6-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