@@ -4018,7 +4018,8 @@ static int alloc_identity_pagetable(struct kvm *kvm)
if (r)
goto out;
- page = gfn_to_page(kvm, kvm->arch.ept_identity_map_addr >> PAGE_SHIFT);
+ page = gfn_to_page_no_pin(kvm,
+ kvm->arch.ept_identity_map_addr >> PAGE_SHIFT);
if (is_error_page(page)) {
r = -EFAULT;
goto out;
@@ -7177,8 +7177,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
kvm_free_vcpus(kvm);
if (kvm->arch.apic_access_page)
put_page(kvm->arch.apic_access_page);
- if (kvm->arch.ept_identity_pagetable)
- put_page(kvm->arch.ept_identity_pagetable);
kfree(rcu_dereference_check(kvm->arch.apic_map, 1));
}
ept identity page is pinned in memory. As a result, it cannot be migrated/hot-removed. Actually, this page is not necessary to be pinned. When it is migrated, mmu_notifier_invalidate_page() in try_to_unmap_one() will invalidate the ept entry so that the guest won't be able to access the page. And in the next ept violation, the new page will be found by ept violation handler. This patch just unpin the ept identity page because it is not necessary. Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> --- arch/x86/kvm/vmx.c | 3 ++- arch/x86/kvm/x86.c | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-)