From: Sean Christopherson <sean.j.christopherson@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Adam Borowski <kilobyte@angband.pl>,
David Hildenbrand <david@redhat.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH v2 0/3] KVM: MMU: Fix a refcount bug with ZONE_DEVICE pages
Date: Mon, 11 Nov 2019 14:12:26 -0800 [thread overview]
Message-ID: <20191111221229.24732-1-sean.j.christopherson@intel.com> (raw)
This mini-series fixes a suspected, but technically unconfirmed, bug in
KVM related to ZONE_DEVICE pages. The suspected issue is that KVM treats
ZONE_DEVICE pages as reserved PFNs, and so doesn't put references to such
pages when dropping references via KVM's generic kvm_release_pfn_clean().
David Hildenbrand uncovered the bug during a discussion about removing
PG_reserved from ZONE_DEVICE pages, after Dan Williams pointed out[1] that
there was a bug report from Adam Borowski[2] that was likely related to
KVM's interaction with PageReserved().
Patch 1/3 contains the actual fix, patches 2/3 and 3/3 are minor cleanup
that is mostly unrelated, but dependent and prompted by the fix itself.
v2:
- Remove the kvm_is_zone_device_pfn(pfn) check from kvm_get_pfn(). It's
not entirely clear whether or not the hva_to_pfn_remapped() case is
actually broken, e.g. KVM's page fault handler is likely ok, whereas
not calling get_page() willl definitely cause breakage as KVM would
later call put_page() on the pfn/page. [Paolo]
- WARN if kvm_is_zone_device_pfn() is called without the underlying
page being pinned. This won't necessarily catch all bugs, e.g. if
the above hva_to_pfn_remapped case is indeed broken, but will
prevent completely bogus usage. [Dan]
- Remove the is_error_pfn() check from transparent_hugepage_adjust()
instead of carrying it forward into the new kvm_is_hugepage_allowed()
helper. [Paolo]
[1] http://lkml.kernel.org/r/20190919115547.GA17963@angband.pl
[2] https://lkml.kernel.org/r/01adb4cb-6092-638c-0bab-e61322be7cf5@redhat.com
Sean Christopherson (3):
KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved
KVM: x86/mmu: Remove superfluous is_error_pfn() check from THP adjust
KVM: x86/mmu: Add helper to consolidate huge page promotion
arch/x86/kvm/mmu.c | 15 +++++++++------
include/linux/kvm_host.h | 1 +
virt/kvm/kvm_main.c | 26 +++++++++++++++++++++++---
3 files changed, 33 insertions(+), 9 deletions(-)
--
2.24.0
next reply other threads:[~2019-11-11 22:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-11 22:12 Sean Christopherson [this message]
2019-11-11 22:12 ` [PATCH v2 1/3] KVM: MMU: Do not treat ZONE_DEVICE pages as being reserved Sean Christopherson
2019-11-11 22:20 ` Paolo Bonzini
2019-11-11 22:39 ` Dan Williams
2019-11-11 22:43 ` Paolo Bonzini
2019-11-12 7:06 ` David Hildenbrand
2019-11-11 22:12 ` [PATCH v2 2/3] KVM: x86/mmu: Remove superfluous is_error_pfn() check from THP adjust Sean Christopherson
2019-11-11 22:12 ` [PATCH v2 3/3] KVM: x86/mmu: Add helper to consolidate huge page promotion Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191111221229.24732-1-sean.j.christopherson@intel.com \
--to=sean.j.christopherson@intel.com \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kilobyte@angband.pl \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®