summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-02-25 21:22:43 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2022-03-01 16:58:24 +0300
commitf6d0a2521ce1cc3aea760ea42b43c428e1c98108 (patch)
tree95b50aa25f3342bdd650c39ec6dcefc42c3e1d36
parent1e326ad429784a16b2b34ec296ff4ca7ad42c220 (diff)
downloadlinux-f6d0a2521ce1cc3aea760ea42b43c428e1c98108.tar.xz
KVM: x86: Invoke kvm_mmu_unload() directly on CR4.PCIDE change
Replace a KVM_REQ_MMU_RELOAD request with a direct kvm_mmu_unload() call when the guest's CR4.PCIDE changes. This will allow tweaking the logic of KVM_REQ_MMU_RELOAD to free only obsolete/invalid roots, which is the historical intent of KVM_REQ_MMU_RELOAD. The recent PCIDE behavior is the only user of KVM_REQ_MMU_RELOAD that doesn't mark affected roots as obsolete, needs to unconditionally unload the entire MMU, _and_ affects only the current vCPU. Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20220225182248.3812651-3-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fce6bc707122..18977693517a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1079,7 +1079,7 @@ void kvm_post_set_cr4(struct kvm_vcpu *vcpu, unsigned long old_cr4, unsigned lon
*/
if (!tdp_enabled &&
(cr4 & X86_CR4_PCIDE) && !(old_cr4 & X86_CR4_PCIDE))
- kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
+ kvm_mmu_unload(vcpu);
/*
* The TLB has to be flushed for all PCIDs if any of the following