From: "Radim Krčmář" <rkrcmar@redhat.com>
To: "Jan H. Schönherr" <jschoenh@amazon.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
David Hildenbrand <david@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Fix immediate_exit handling for uninitialized AP
Date: Wed, 13 Sep 2017 17:33:08 +0200 [thread overview]
Message-ID: <20170913153308.GF2673@flask> (raw)
In-Reply-To: <1504715646-29879-1-git-send-email-jschoenh@amazon.de>
2017-09-06 18:34+0200, Jan H. Schönherr:
> When user space sets kvm_run->immediate_exit, KVM is supposed to
> return quickly. However, when a vCPU is in KVM_MP_STATE_UNINITIALIZED,
> the value is not considered and the vCPU blocks.
>
> Fix that oversight.
>
> Fixes: 460df4c1fc7c008 ("KVM: race-free exit from KVM_RUN without POSIX signals")
> Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
> ---
> compile-time tested only
> ---
> arch/x86/kvm/x86.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 40039cd..a69a948 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7199,6 +7199,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
>
> if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) {
> + if (kvm_run->immediate_exit) {
> + r = -EINTR;
> + goto out;
> + }
> kvm_vcpu_block(vcpu);
Without immediate_exit, we would also execute the following code, but I
think it's ok not to ... queued, thanks.
> kvm_apic_accept_events(vcpu);
> kvm_clear_request(KVM_REQ_UNHALT, vcpu);
> --
> 2.3.1.dirty
>
prev parent reply other threads:[~2017-09-13 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 16:34 [PATCH] KVM: x86: Fix immediate_exit handling for uninitialized AP Jan H. Schönherr
2017-09-13 15:33 ` Radim Krčmář [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=20170913153308.GF2673@flask \
--to=rkrcmar@redhat.com \
--cc=david@redhat.com \
--cc=jschoenh@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@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.