| From 45e19cfe9e152b9bb4140a9dc59cb0b31dd6705b Mon Sep 17 00:00:00 2001 |
| From: David Stevens <stevensd@chromium.org> |
| Date: Fri, 25 Jun 2021 16:36:16 +0900 |
| Subject: [PATCH] FROMLIST: KVM: mmu: remove over-aggressive warnings |
| |
| Remove two warnings that require ref counts for pages to be non-zero, as |
| mapped pfns from follow_pfn may not have an initialized ref count. |
| |
| Signed-off-by: David Stevens <stevensd@chromium.org> |
| (am from https://lore.kernel.org/patchwork/patch/1451588/) |
| (also found at https://lore.kernel.org/r/20210625073616.2184426-6-stevensd@google.com) |
| |
| BUG=b:184929592, b:176387875 |
| TEST=tast run zork arc.VideoDecodeAccel.vp9_vm |
| |
| Change-Id: I81a0f12d881470eb469f0c83aecb1b03b74afcaf |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3002595 |
| Tested-by: David Stevens <stevensd@chromium.org> |
| Reviewed-by: Sean Paul <seanpaul@chromium.org> |
| Reviewed-by: Suleiman Souhlal <suleiman@chromium.org> |
| Commit-Queue: David Stevens <stevensd@chromium.org> |
| --- |
| arch/x86/kvm/mmu/mmu.c | 10 ---------- |
| virt/kvm/kvm_main.c | 2 +- |
| 2 files changed, 1 insertion(+), 11 deletions(-) |
| |
| diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c |
| index 1ccb769f62af35b2c65f6d23905555263373ade7..f36cd287c195985f9af9fe2784eab818bffdd68b 100644 |
| --- a/arch/x86/kvm/mmu/mmu.c |
| +++ b/arch/x86/kvm/mmu/mmu.c |
| @@ -534,7 +534,6 @@ static u64 mmu_spte_clear_track_bits(struct kvm *kvm, u64 *sptep) |
| kvm_pfn_t pfn; |
| u64 old_spte = *sptep; |
| int level = sptep_to_sp(sptep)->role.level; |
| - struct page *page; |
| |
| if (!is_shadow_present_pte(old_spte) || |
| !spte_has_volatile_bits(old_spte)) |
| @@ -549,15 +548,6 @@ static u64 mmu_spte_clear_track_bits(struct kvm *kvm, u64 *sptep) |
| |
| pfn = spte_to_pfn(old_spte); |
| |
| - /* |
| - * KVM doesn't hold a reference to any pages mapped into the guest, and |
| - * instead uses the mmu_notifier to ensure that KVM unmaps any pages |
| - * before they are reclaimed. Sanity check that, if the pfn is backed |
| - * by a refcounted page, the refcount is elevated. |
| - */ |
| - page = kvm_pfn_to_refcounted_page(pfn); |
| - WARN_ON(page && !page_count(page)); |
| - |
| if (is_accessed_spte(old_spte)) |
| kvm_set_pfn_accessed(pfn); |
| |
| diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
| index 25d7872b29c17ee554eff1f3b5702a33b17a4143..8cf297452c3ed954801bbdcc23010e94ea965fb9 100644 |
| --- a/virt/kvm/kvm_main.c |
| +++ b/virt/kvm/kvm_main.c |
| @@ -176,7 +176,7 @@ bool kvm_is_zone_device_page(struct page *page) |
| * the device has been pinned, e.g. by get_user_pages(). WARN if the |
| * page_count() is zero to help detect bad usage of this helper. |
| */ |
| - if (WARN_ON_ONCE(!page_count(page))) |
| + if (!page_count(page)) |
| return false; |
| |
| return is_zone_device_page(page); |
| -- |
| 2.38.1.584.g0f3c55d4c2-goog |
| |