Re: [GIT PULL] KVM: x86: MMU changes for 6.6

From: Sean Christopherson
Date: Fri Sep 01 2023 - 14:43:08 EST


On Thu, Aug 31, 2023, Paolo Bonzini wrote:
> On Thu, Aug 31, 2023 at 7:27 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> >
> > +Like
> >
> > On Tue, Aug 29, 2023, Sean Christopherson wrote:
> > > Please pull MMU changes for 6.6, with a healthy dose of KVMGT cleanups mixed in.
> > > The other highlight is finally purging the old MMU_DEBUG code and replacing it
> > > with CONFIG_KVM_PROVE_MMU.
> > >
> > > All KVMGT patches have been reviewed/acked and tested by KVMGT folks. A *huge*
> > > thanks to them for all the reviews and testing, and to Yan in particular.
> >
> > FYI, Like found a brown paper bag bug[*] that causes selftests that move memory
> > regions to fail when compiled with CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y. I'm
> > redoing testing today with that forced on, but barring more falling, the fix is:
>
> Ok, I'll apply these by hand.

In case you haven't taken care of this already, here's an "official" tested fix.

Like, if you can give your SoB, I'd rather give you full author credit and sub
me out entirely.

--
From: Sean Christopherson <seanjc@xxxxxxxxxx>
Date: Fri, 1 Sep 2023 16:55:56 +0000
Subject: [PATCH] KVM: x86/mmu: Fix inverted check when detecting external page
tracker(s)

When checking for the presence of external users of page write tracking,
check that the list of external trackers is NOT empty.

Fixes: aa611a99adb4 ("KVM: x86: Reject memslot MOVE operations if KVMGT is attached")
Reported-by: Like Xu <like.xu.linux@xxxxxxxxx>
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/mmu/page_track.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/page_track.h b/arch/x86/kvm/mmu/page_track.h
index 62f98c6c5af3..d4d72ed999b1 100644
--- a/arch/x86/kvm/mmu/page_track.h
+++ b/arch/x86/kvm/mmu/page_track.h
@@ -32,7 +32,7 @@ void kvm_page_track_delete_slot(struct kvm *kvm, struct kvm_memory_slot *slot);

static inline bool kvm_page_track_has_external_user(struct kvm *kvm)
{
- return hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list);
+ return !hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list);
}
#else
static inline int kvm_page_track_init(struct kvm *kvm) { return 0; }

base-commit: 22a1c60f8beca52229911b5133d010ff76588921
--