]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
KVM: nVMX: Reset register cache (available and dirty masks) on VMCS switch
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 15 Apr 2020 20:34:51 +0000 (13:34 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 21 Apr 2020 13:13:06 +0000 (09:13 -0400)
commite5d03de5937e915c8e41b6357c337529dfae6797
tree5e46bee548b17b81b06231f27a1fef0d02bb843e
parent9932b49e5abef0218254d15b8278e3dbee5ceea3
KVM: nVMX: Reset register cache (available and dirty masks) on VMCS switch

Reset the per-vCPU available and dirty register masks when switching
between vmcs01 and vmcs02, as the masks track state relative to the
current VMCS.  The stale masks don't cause problems in the current code
base because the registers are either unconditionally written on nested
transitions or, in the case of segment registers, have an additional
tracker that is manually reset.

Note, by dropping (previously implicitly, now explicitly) the dirty mask
when switching the active VMCS, KVM is technically losing writes to the
associated fields.  But, the only regs that can be dirtied (RIP, RSP and
PDPTRs) are unconditionally written on nested transitions, e.g. explicit
writeback is a waste of cycles, and a WARN_ON would be rather pointless.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200415203454.8296-3-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h