On Wed, Nov 10, 2021 at 02:29:52PM -0800, Ben Gardon wrote: > When recursively clearing out disconnected pts, the range based TLB > flush in handle_removed_tdp_mmu_page uses the wrong starting GFN, > resulting in the flush mostly missing the affected range. Fix this by > using base_gfn for the flush. > > Fixes: a066e61f13cf ("KVM: x86/mmu: Factor out handling of removed page tables") > CC: stable@xxxxxxxxxxxxxxx > > Signed-off-by: Ben Gardon <bgardon@xxxxxxxxxx> > --- > arch/x86/kvm/mmu/tdp_mmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > index 7c5dd83e52de..866c2b191e1e 100644 > --- a/arch/x86/kvm/mmu/tdp_mmu.c > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > @@ -374,7 +374,7 @@ static void handle_removed_tdp_mmu_page(struct kvm *kvm, tdp_ptep_t pt, > shared); > } > > - kvm_flush_remote_tlbs_with_address(kvm, gfn, > + kvm_flush_remote_tlbs_with_address(kvm, base_gfn, Suggest pulling the definition of gfn into the for loop as well (along with sptep and old_child_spte for that matter) so that referencing it here isn't even possible. > KVM_PAGES_PER_HPAGE(level + 1)); > > call_rcu(&sp->rcu_head, tdp_mmu_free_sp_rcu_callback); > -- > 2.34.0.rc0.344.g81b53c2807-goog >