Message ID | 20180828160459.14093-5-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: nVMX: add option to perform early consistency checks via H/W | expand |
On Tue, Aug 28, 2018 at 9:04 AM, Sean Christopherson <sean.j.christopherson@intel.com> wrote: > Reset the vm_{entry,exit}_controls_shadow variables as well as the > segment cache on consistency check VMExit. The shadow values in > particular can lead to missed updates due to stale shadows. I feel like this should go into vmx_switch_vmcs() instead. Every time we switch vmcs, for whatever reason, the shadows are going to be stale.
On Wed, Sep 19, 2018 at 02:22:09PM -0700, Jim Mattson wrote: > On Tue, Aug 28, 2018 at 9:04 AM, Sean Christopherson > <sean.j.christopherson@intel.com> wrote: > > Reset the vm_{entry,exit}_controls_shadow variables as well as the > > segment cache on consistency check VMExit. The shadow values in > > particular can lead to missed updates due to stale shadows. > > I feel like this should go into vmx_switch_vmcs() instead. Every time > we switch vmcs, for whatever reason, the shadows are going to be > stale. That would make a lot more sense.
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index b7aca0edeb59..6097d0115056 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -13355,12 +13355,18 @@ static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, u32 reason, unsigned long qualification) { + struct vcpu_vmx *vmx = to_vmx(vcpu); + + vm_entry_controls_reset_shadow(vmx); + vm_exit_controls_reset_shadow(vmx); + vmx_segment_cache_clear(vmx); + load_vmcs12_host_state(vcpu, vmcs12); vmcs12->vm_exit_reason = reason | VMX_EXIT_REASONS_FAILED_VMENTRY; vmcs12->exit_qualification = qualification; nested_vmx_succeed(vcpu); if (enable_shadow_vmcs) - to_vmx(vcpu)->nested.sync_shadow_vmcs = true; + vmx->nested.sync_shadow_vmcs = true; } static int vmx_check_intercept(struct kvm_vcpu *vcpu,
Reset the vm_{entry,exit}_controls_shadow variables as well as the segment cache on consistency check VMExit. The shadow values in particular can lead to missed updates due to stale shadows. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/kvm/vmx.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)