[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190730030850.GM21120@linux.intel.com>
Date: Mon, 29 Jul 2019 20:08:51 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>
Cc: "H. Peter Anvin" <hpa@...or.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sgx@...r.kernel.org,
Andy Lutomirski <luto@...capital.net>
Subject: Re: [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.
Powered by blists - more mailing lists