Re: [PATCH 0/5] KVM: x86/mmu: TDP MMU fixes for 6.2

From: Sean Christopherson
Date: Wed Dec 14 2022 - 10:52:21 EST


On Wed, Dec 14, 2022, Robert Hoo wrote:
> On Tue, 2022-12-13 at 03:30 +0000, Sean Christopherson wrote:
> > Fix three fatal TDP MMU bugs introduced in 6.2,
>
> introduced in 6.1? or earlier?

6.2, or more precisely, code sitting in kvm/next that will hopefully become part
of 6.2-rc1.

> > harden related code,
> > and clean up kvm_tdp_mmu_map() to eliminate the need for gotos.
> >
> > Sean Christopherson (5):
> > KVM: x86/mmu: Don't attempt to map leaf if target TDP MMU SPTE is
> > frozen
> > KVM: x86/mmu: Map TDP MMU leaf SPTE iff target level is reached
> > KVM: x86/mmu: Re-check under lock that TDP MMU SP hugepage is
> > disallowed
> > KVM: x86/mmu: Don't install TDP MMU SPTE if SP has unexpected level
> > KVM: x86/mmu: Move kvm_tdp_mmu_map()'s prolog and epilog to its
> > caller
> >
> > arch/x86/kvm/mmu/mmu.c | 9 +++++++-
> > arch/x86/kvm/mmu/mmu_internal.h | 1 -
> > arch/x86/kvm/mmu/tdp_mmu.c | 39 +++++++++++++++--------------
> > ----
> > 3 files changed, 26 insertions(+), 23 deletions(-)
> >
> >
> > base-commit: 51229fd7872f82af07498aef5c79ad51baf81ea0
>
> I cannot find this base commit in my tree, where I just pulled to
> latest queue yesterday. But find this series can be applied to this
> latest queue as well.

Ya, I have an extra commit in my local repo sitting on top of kvm/queue so that
my standard builds don't fail.

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index cc3e8c7d0850..2c7f2a26421e 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -898,6 +898,7 @@ bool kvm_hv_assist_page_enabled(struct kvm_vcpu *vcpu)
return false;
return vcpu->arch.pv_eoi.msr_val & KVM_MSR_ENABLED;
}
+EXPORT_SYMBOL_GPL(kvm_hv_assist_page_enabled);

int kvm_hv_get_assist_page(struct kvm_vcpu *vcpu)
{