Re: [PATCH] KVM: x86: extend usage of RET_MMIO_PF_* constants
From: Radim KrÄmÃÅ
Date: Tue Oct 10 2017 - 15:16:22 EST
2017-10-10 11:10+0200, Paolo Bonzini:
> The x86 MMU if full of code that returns 0 and 1 for retry/emulate. Use
> the existing RET_MMIO_PF_RETRY/RET_MMIO_PF_EMULATE enum, renaming it to
> drop the MMIO part.
>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> @@ -788,7 +788,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
>
> if (try_async_pf(vcpu, prefault, walker.gfn, addr, &pfn, write_fault,
> &map_writable))
> - return 0;
> + return RET_PF_RETRY;
>
> if (handle_abnormal_pfn(vcpu, addr, walker.gfn, pfn, walker.pte_access, &r))
> return r;
> @@ -833,7 +833,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
> out_unlock:
> spin_unlock(&vcpu->kvm->mmu_lock);
> kvm_release_pfn_clean(pfn);
> - return 0;
> + return RET_PF_EMULATE;
A direct conversion would return RET_PF_RETRY, is this some
optimization?
Apart from that,
Reviewed-by: Radim KrÄmÃÅ <rkrcmar@xxxxxxxxxx>
Thanks.