Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-18 Thread David Hildenbrand
On 17.08.2017 18:36, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22).
> 
> handle_mmio_page_fault() can now be made static.
> 
> Signed-off-by: Paolo Bonzini 
> ---
>   v1->v2: make the function static.
> 
>  arch/x86/kvm/mmu.c | 19 ++-
>  arch/x86/kvm/mmu.h | 17 -
>  arch/x86/kvm/vmx.c | 13 +++--
>  3 files changed, 21 insertions(+), 28 deletions(-)

Reviewed-by: David Hildenbrand 


-- 

Thanks,

David


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-18 Thread David Hildenbrand
On 17.08.2017 18:36, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22).
> 
> handle_mmio_page_fault() can now be made static.
> 
> Signed-off-by: Paolo Bonzini 
> ---
>   v1->v2: make the function static.
> 
>  arch/x86/kvm/mmu.c | 19 ++-
>  arch/x86/kvm/mmu.h | 17 -
>  arch/x86/kvm/vmx.c | 13 +++--
>  3 files changed, 21 insertions(+), 28 deletions(-)

Reviewed-by: David Hildenbrand 


-- 

Thanks,

David


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-17 Thread David Hildenbrand
On 11.08.2017 18:52, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22)
> 
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/vmx.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index df8d2f127508..45fb0ea78ee8 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6410,17 +6410,10 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
>   return kvm_skip_emulated_instruction(vcpu);
>   }
>  
> - ret = handle_mmio_page_fault(vcpu, gpa, true);
>   vcpu->arch.gpa_available = true;
> - if (likely(ret == RET_MMIO_PF_EMULATE))
> - return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
> -   EMULATE_DONE;
> -
> - if (unlikely(ret == RET_MMIO_PF_INVALID))
> - return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
> -
> - if (unlikely(ret == RET_MMIO_PF_RETRY))
> - return 1;
> + ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
> + if (ret >= 0)
> + return ret;
>  
>   /* It is the real ept misconfig */
>   WARN_ON(1);
> 

I think we can now un-export handle_mmio_page_fault(), as it is only
arch/x86/kvm/mmu.c

-- 

Thanks,

David


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-17 Thread David Hildenbrand
On 11.08.2017 18:52, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22)
> 
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/vmx.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index df8d2f127508..45fb0ea78ee8 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6410,17 +6410,10 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
>   return kvm_skip_emulated_instruction(vcpu);
>   }
>  
> - ret = handle_mmio_page_fault(vcpu, gpa, true);
>   vcpu->arch.gpa_available = true;
> - if (likely(ret == RET_MMIO_PF_EMULATE))
> - return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
> -   EMULATE_DONE;
> -
> - if (unlikely(ret == RET_MMIO_PF_INVALID))
> - return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
> -
> - if (unlikely(ret == RET_MMIO_PF_RETRY))
> - return 1;
> + ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
> + if (ret >= 0)
> + return ret;
>  
>   /* It is the real ept misconfig */
>   WARN_ON(1);
> 

I think we can now un-export handle_mmio_page_fault(), as it is only
arch/x86/kvm/mmu.c

-- 

Thanks,

David


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-17 Thread David Hildenbrand
On 11.08.2017 18:52, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22)
> 
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/vmx.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index df8d2f127508..45fb0ea78ee8 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6410,17 +6410,10 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
>   return kvm_skip_emulated_instruction(vcpu);
>   }
>  
> - ret = handle_mmio_page_fault(vcpu, gpa, true);
>   vcpu->arch.gpa_available = true;
> - if (likely(ret == RET_MMIO_PF_EMULATE))
> - return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
> -   EMULATE_DONE;
> -
> - if (unlikely(ret == RET_MMIO_PF_INVALID))
> - return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
> -
> - if (unlikely(ret == RET_MMIO_PF_RETRY))
> - return 1;
> + ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
> + if (ret >= 0)
> + return ret;
>  
>   /* It is the real ept misconfig */
>   WARN_ON(1);
> 

Reviewed-by: David Hildenbrand 

-- 

Thanks,

David


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-17 Thread David Hildenbrand
On 11.08.2017 18:52, Paolo Bonzini wrote:
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22)
> 
> Signed-off-by: Paolo Bonzini 
> ---
>  arch/x86/kvm/vmx.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index df8d2f127508..45fb0ea78ee8 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6410,17 +6410,10 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
>   return kvm_skip_emulated_instruction(vcpu);
>   }
>  
> - ret = handle_mmio_page_fault(vcpu, gpa, true);
>   vcpu->arch.gpa_available = true;
> - if (likely(ret == RET_MMIO_PF_EMULATE))
> - return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
> -   EMULATE_DONE;
> -
> - if (unlikely(ret == RET_MMIO_PF_INVALID))
> - return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
> -
> - if (unlikely(ret == RET_MMIO_PF_RETRY))
> - return 1;
> + ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
> + if (ret >= 0)
> + return ret;
>  
>   /* It is the real ept misconfig */
>   WARN_ON(1);
> 

Reviewed-by: David Hildenbrand 

-- 

Thanks,

David


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-12 Thread Wanpeng Li
2017-08-12 0:52 GMT+08:00 Paolo Bonzini :
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22)
>
> Signed-off-by: Paolo Bonzini 

Reviewed-by: Wanpeng Li 

> ---
>  arch/x86/kvm/vmx.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index df8d2f127508..45fb0ea78ee8 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6410,17 +6410,10 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
> return kvm_skip_emulated_instruction(vcpu);
> }
>
> -   ret = handle_mmio_page_fault(vcpu, gpa, true);
> vcpu->arch.gpa_available = true;
> -   if (likely(ret == RET_MMIO_PF_EMULATE))
> -   return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
> - EMULATE_DONE;
> -
> -   if (unlikely(ret == RET_MMIO_PF_INVALID))
> -   return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
> -
> -   if (unlikely(ret == RET_MMIO_PF_RETRY))
> -   return 1;
> +   ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
> +   if (ret >= 0)
> +   return ret;
>
> /* It is the real ept misconfig */
> WARN_ON(1);
> --
> 1.8.3.1
>
>


Re: [PATCH 1/3] KVM: x86: simplify ept_misconfig

2017-08-12 Thread Wanpeng Li
2017-08-12 0:52 GMT+08:00 Paolo Bonzini :
> Calling handle_mmio_page_fault() has been unnecessary since commit
> e9ee956e311d ("KVM: x86: MMU: Move handle_mmio_page_fault() call to
> kvm_mmu_page_fault()", 2016-02-22)
>
> Signed-off-by: Paolo Bonzini 

Reviewed-by: Wanpeng Li 

> ---
>  arch/x86/kvm/vmx.c | 13 +++--
>  1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index df8d2f127508..45fb0ea78ee8 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6410,17 +6410,10 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
> return kvm_skip_emulated_instruction(vcpu);
> }
>
> -   ret = handle_mmio_page_fault(vcpu, gpa, true);
> vcpu->arch.gpa_available = true;
> -   if (likely(ret == RET_MMIO_PF_EMULATE))
> -   return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
> - EMULATE_DONE;
> -
> -   if (unlikely(ret == RET_MMIO_PF_INVALID))
> -   return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
> -
> -   if (unlikely(ret == RET_MMIO_PF_RETRY))
> -   return 1;
> +   ret = kvm_mmu_page_fault(vcpu, gpa, PFERR_RSVD_MASK, NULL, 0);
> +   if (ret >= 0)
> +   return ret;
>
> /* It is the real ept misconfig */
> WARN_ON(1);
> --
> 1.8.3.1
>
>