lkml.org 
[lkml]   [2022]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC v1 2/9] KVM: x86/mmu: Move hugepage adjust to direct_page_fault
Date
Both TDP MMU and legacy MMU do hugepage adjust in the mapping routine.
Adjust the pfn early in the common code. This will be used by the
following patches for pinning the pages.

No functional change intended.

Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
---
arch/x86/kvm/mmu/mmu.c | 4 ++--
arch/x86/kvm/mmu/tdp_mmu.c | 2 --
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 8e24f73bf60b..db1feecd6fed 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -2940,8 +2940,6 @@ static int __direct_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
int ret;
gfn_t base_gfn = fault->gfn;

- kvm_mmu_hugepage_adjust(vcpu, fault);
-
trace_kvm_mmu_spte_requested(fault);
for_each_shadow_entry(vcpu, fault->addr, it) {
/*
@@ -4035,6 +4033,8 @@ static int direct_page_fault(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault

r = RET_PF_RETRY;

+ kvm_mmu_hugepage_adjust(vcpu, fault);
+
if (is_tdp_mmu_fault)
read_lock(&vcpu->kvm->mmu_lock);
else
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index bc9e3553fba2..e03bf59b2f81 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -959,8 +959,6 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
u64 new_spte;
int ret;

- kvm_mmu_hugepage_adjust(vcpu, fault);
-
trace_kvm_mmu_spte_requested(fault);

rcu_read_lock();
--
2.32.0
\
 
 \ /
  Last update: 2022-03-08 05:41    [W:0.267 / U:0.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site