KVM: Don't grab reference on VM_MIXEDMAP pfns that have a "struct page"
authorSean Christopherson <seanjc@google.com>
Thu, 10 Oct 2024 18:24:27 +0000 (11:24 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Oct 2024 17:01:35 +0000 (13:01 -0400)
commit8b15c3764c05ed8766709711d2054d96349dee8e
tree2b28e7b160c28d374682ecf290d2a26796c05044
parent93b7da404f5b0b02a4211bbb784889f001d27953
KVM: Don't grab reference on VM_MIXEDMAP pfns that have a "struct page"

Now that KVM no longer relies on an ugly heuristic to find its struct page
references, i.e. now that KVM can't get false positives on VM_MIXEDMAP
pfns, remove KVM's hack to elevate the refcount for pfns that happen to
have a valid struct page.  In addition to removing a long-standing wart
in KVM, this allows KVM to map non-refcounted struct page memory into the
guest, e.g. for exposing GPU TTM buffers to KVM guests.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20241010182427.1434605-86-seanjc@google.com>
include/linux/kvm_host.h
virt/kvm/kvm_main.c