Re: [PATCH v8 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler
From: Radim KrÄmÃÅ
Date: Fri Jul 14 2017 - 08:39:49 EST
2017-07-13 18:30-0700, Wanpeng Li:
> From: Wanpeng Li <wanpeng.li@xxxxxxxxxxx>
>
> This patch adds the L1 guest async page fault #PF vmexit handler, such
> by L1 similar to ordinary async page fault.
>
> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> Cc: Radim KrÄmÃÅ <rkrcmar@xxxxxxxxxx>
> Signed-off-by: Wanpeng Li <wanpeng.li@xxxxxxxxxxx>
> ---
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> @@ -3780,6 +3781,37 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn,
> return false;
> }
>
> +int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
> + u64 fault_address, char *insn, int insn_len,
> + bool need_unprotect)
> +{
> + int r = 1;
> +
> + switch (vcpu->arch.apf.host_apf_reason) {
> + default:
> + trace_kvm_page_fault(fault_address, error_code);
> +
> + if (need_unprotect && kvm_event_needs_reinjection(vcpu))
> + kvm_mmu_unprotect_page_virt(vcpu, fault_address);
> + r = kvm_mmu_page_fault(vcpu, fault_address, error_code, NULL, 0);
I changed this when applying (my patch was crappy), the arguments
shouldn't be lost:
kvm_mmu_page_fault(vcpu, fault_address, error_code, insn, insn_len);
It will be in the second merge window pull request if nothing goes bad,
thanks.