Skip to content

Commit

Permalink
KVM: x86/mmu: Expand collapsible SPTE zap for TDP MMU to ZONE_DEVICE …
Browse files Browse the repository at this point in the history
…and HugeTLB pages

[ Upstream commit c060c72 ]

Zap SPTEs that are backed by ZONE_DEVICE pages when zappings SPTEs to
rebuild them as huge pages in the TDP MMU.  ZONE_DEVICE huge pages are
managed differently than "regular" pages and are not compound pages.
Likewise, PageTransCompoundMap() will not detect HugeTLB, so switch
to PageCompound().

This matches the similar check in kvm_mmu_zap_collapsible_spte.

Cc: Ben Gardon <bgardon@google.com>
Fixes: 1488199 ("kvm: x86/mmu: Support disabling dirty logging for the tdp MMU")
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210213005015.1651772-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
sean-jc authored and gregkh committed Mar 4, 2021
1 parent ec84d89 commit 0e40ac6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/x86/kvm/mmu/tdp_mmu.c
Expand Up @@ -1067,7 +1067,8 @@ static void zap_collapsible_spte_range(struct kvm *kvm,

pfn = spte_to_pfn(iter.old_spte);
if (kvm_is_reserved_pfn(pfn) ||
!PageTransCompoundMap(pfn_to_page(pfn)))
(!PageCompound(pfn_to_page(pfn)) &&
!kvm_is_zone_device_pfn(pfn)))
continue;

tdp_mmu_set_spte(kvm, &iter, 0);
Expand Down

0 comments on commit 0e40ac6

Please sign in to comment.