lkml.org 
[lkml]   [2019]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 08/21] KVM: x86: Add kvm_x86_ops hook to short circuit emulation
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.

\
 
 \ /
  Last update: 2019-07-30 05:09    [W:0.347 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site