[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c88b7037e410dea368496319a8427f8924a7585f.1659854790.git.isaku.yamahata@intel.com>
Date: Sun, 7 Aug 2022 15:01:41 -0700
From: isaku.yamahata@...el.com
To: kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: isaku.yamahata@...el.com, isaku.yamahata@...il.com,
Paolo Bonzini <pbonzini@...hat.com>, erdemaktas@...gle.com,
Sean Christopherson <seanjc@...gle.com>,
Sagi Shahar <sagis@...gle.com>
Subject: [PATCH v8 056/103] KVM: x86/mmu: Let vcpu re-try when faulting page type conflict
From: Xiaoyao Li <xiaoyao.li@...el.com>
When it gets a private page fault on a shared page, or vice verse, let
vcpu retry and vcpu will keep faulting until other vcpu maps the gpa to
matched page type.
Signed-off-by: Xiaoyao Li <xiaoyao.li@...el.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
---
arch/x86/kvm/mmu/mmu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 27deaf44ee80..c9c27945ed44 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -4230,6 +4230,10 @@ static int kvm_faultin_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault)
return RET_PF_EMULATE;
}
+ if (kvm_gfn_shared_mask(vcpu->kvm) &&
+ (kvm_mem_is_private(vcpu->kvm, fault->gfn) != fault->is_private))
+ return RET_PF_RETRY;
+
async = false;
fault->pfn = __gfn_to_pfn_memslot(slot, fault->gfn, false, &async,
fault->write, &fault->map_writable,
--
2.25.1
Powered by blists - more mailing lists