Message ID | 20230315021738.1151386-6-amoorthy@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Avoiding slow get-user-pages via memory fault exit | expand |
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index c8ebe542c565f..0b02e2c360c08 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3193,7 +3193,10 @@ static int direct_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) } if (WARN_ON_ONCE(it.level != fault->goal_level)) - return -EFAULT; + return kvm_memfault_exit_or_efault( + vcpu, fault->gfn * PAGE_SIZE, + KVM_PAGES_PER_HPAGE(fault->goal_level), + KVM_MEMFAULT_REASON_UNKNOWN); ret = mmu_set_spte(vcpu, fault->slot, it.sptep, ACC_ALL, base_gfn, fault->pfn, fault);