Re: [RFC PATCH 08/21] KVM: x86: Add kvm_x86_ops hook to short circuit emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 26, 2019 at 10:52:01PM -0700, Sean Christopherson wrote:
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 48c865a4e5dd..0fb8b60eb136 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -7115,10 +7115,25 @@ static int nested_enable_evmcs(struct kvm_vcpu *vcpu,
>  	return -ENODEV;
>  }
>  
> -static bool svm_need_emulation_on_page_fault(struct kvm_vcpu *vcpu)
> +static bool svm_is_emulatable(struct kvm_vcpu *vcpu, void *insn, int insn_len)
>  {
>  	bool is_user, smap;
>  
> +	if (likely(!insn || insn_len))
> +		return true;
> +
> +	/*
> +	 * Under certain conditions insn_len may be zero on #NPF.  This can
> +	 * happen if a guest gets a page-fault on data access but the HW table
> +	 * walker is not able to read the instruction page (e.g instruction
> +	 * page is not present in memory). In those cases we simply restart the
> +	 * guest, with the exception of AMD Erratum 1096 which is unrecoverable.
> +	 */
> +	if (unlikely(insn && !insn_len)) {
> +		if (!kvm_x86_ops->need_emulation_on_page_fault(vcpu))
> +			return 1;
> +	}

Doh, obviously forgot to compile for SVM when rebasing.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux