]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
KVM: x86: Remove spurious clearing of async #PF MSR
authorSean Christopherson <sean.j.christopherson@intel.com>
Wed, 18 Dec 2019 21:55:06 +0000 (13:55 -0800)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 6 Mar 2020 13:05:59 +0000 (14:05 +0100)
commit07cda1021755a03e09d853c7abb9289aa3ca14ee
treea884b40f9a6372291e903e5f105c84c547d09c62
parenta9f9f045414d2d8715ca4e159810ceaeca9b40d7
KVM: x86: Remove spurious clearing of async #PF MSR

BugLink: https://bugs.launchpad.net/bugs/1866333
commit 208050dac5ef4de5cb83ffcafa78499c94d0b5ad upstream.

Remove a bogus clearing of apf.msr_val from kvm_arch_vcpu_destroy().

apf.msr_val is only set to a non-zero value by kvm_pv_enable_async_pf(),
which is only reachable by kvm_set_msr_common(), i.e. by writing
MSR_KVM_ASYNC_PF_EN.  KVM does not autonomously write said MSR, i.e.
can only be written via KVM_SET_MSRS or KVM_RUN.  Since KVM_SET_MSRS and
KVM_RUN are vcpu ioctls, they require a valid vcpu file descriptor.
kvm_arch_vcpu_destroy() is only called if KVM_CREATE_VCPU fails, and KVM
declares KVM_CREATE_VCPU successful once the vcpu fd is installed and
thus visible to userspace.  Ergo, apf.msr_val cannot be non-zero when
kvm_arch_vcpu_destroy() is called.

Fixes: 344d9588a9df0 ("KVM: Add PV MSR to enable asynchronous page faults delivery.")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/x86/kvm/x86.c