From: Paolo Bonzini <pbonzini@redhat.com>
To: Bandan Das <bsd@redhat.com>, kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Radim Krcmar <rkrcmar@redhat.com>,
jan.kiszka@siemens.com
Subject: Re: [PATCH] KVM: nSVM: Check for NRIPS support before updating control field
Date: Wed, 17 Jun 2015 14:31:25 +0200 [thread overview]
Message-ID: <5581689D.6020002@redhat.com> (raw)
In-Reply-To: <jpg4mmevkya.fsf@redhat.com>
On 11/06/2015 08:05, Bandan Das wrote:
>
> If hardware doesn't support DecodeAssist - a feature that provides
> more information about the intercept in the VMCB, KVM decodes the
> instruction and then updates the next_rip vmcb control field.
> However, NRIP support itself depends on cpuid Fn8000_000A_EDX[NRIPS].
> Since skip_emulated_instruction() doesn't verify nrip support
> before accepting control.next_rip as valid, avoid writing this
> field if support isn't present.
>
> Signed-off-by: Bandan Das <bsd@redhat.com>
> ---
> arch/x86/kvm/svm.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 9afa233..4911bf1 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -511,8 +511,10 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu)
> {
> struct vcpu_svm *svm = to_svm(vcpu);
>
> - if (svm->vmcb->control.next_rip != 0)
> + if (svm->vmcb->control.next_rip != 0) {
> + WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS));
> svm->next_rip = svm->vmcb->control.next_rip;
> + }
>
> if (!svm->next_rip) {
> if (emulate_instruction(vcpu, EMULTYPE_SKIP) !=
> @@ -4317,7 +4319,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,
> break;
> }
>
> - vmcb->control.next_rip = info->next_rip;
> + /* TODO: Advertise NRIPS to guest hypervisor unconditionally */
> + if (static_cpu_has(X86_FEATURE_NRIPS))
> + vmcb->control.next_rip = info->next_rip;
> vmcb->control.exit_code = icpt_info.exit_code;
> vmexit = nested_svm_exit_handled(svm);
>
>
Applied, thanks.
paolo
prev parent reply other threads:[~2015-06-17 12:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 6:05 [PATCH] KVM: nSVM: Check for NRIPS support before updating control field Bandan Das
2015-06-17 12:31 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5581689D.6020002@redhat.com \
--to=pbonzini@redhat.com \
--cc=bsd@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.