kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Wanpeng Li" <kernellwp@gmail.com>, "Radim Krčmář" <rkrcmar@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>, Wanpeng Li <wanpeng.li@hotmail.com>
Subject: Re: [PATCH v2] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2
Date: Wed, 2 Aug 2017 10:13:09 +0200	[thread overview]
Message-ID: <09b9f160-eae2-c7a8-2405-053c7d44dbcb@redhat.com> (raw)
In-Reply-To: <CANRm+CwrKv5mbiJcTjzi8=0Yp_5musFCbAm8tSF_FE3kaZPvCg@mail.gmail.com>

On 02/08/2017 10:05, Wanpeng Li wrote:
>>>
>>> SDM says that with acknowledge interrupt on exit, bit 31 of the VM-exit
>>> interrupt information (valid interrupt) is always set to 1 on
>>> EXIT_REASON_EXTERNAL_INTERRUPT.  We don't want to break hypervisors
>>> expecting an interrupt in that case, so we should do a userspace VM exit
>>> when the window is open and then inject the userspace interrupt with a
>>> VM exit.
>> Agreed.
>>
>>> The simplest thing that came to my mind is to:
>>>
>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>>> index 39a6222bf968..9ad0c882c4f5 100644
>>> --- a/arch/x86/kvm/vmx.c
>>> +++ b/arch/x86/kvm/vmx.c
>>> @@ -10687,7 +10687,8 @@ static int vmx_check_nested_events(struct kvm_vcpu *vcpu, bool external_intr)
>>>                 return 0;
>>>         }
>>>
>>> -       if ((kvm_cpu_has_interrupt(vcpu) || external_intr) &&
>>> +       if ((kvm_cpu_has_interrupt(vcpu) ||
>>> +            (external_intr && !nested_exit_intr_ack_set(vcpu))) &&
>>>             nested_exit_on_intr(vcpu)) {
>>>                 if (vmx->nested.nested_run_pending)
>>>                         return -EBUSY;
>>>
>> Agreed.
>
> What's your opinion, Paolo? :) Actually I considered the above idea
> before, it is what SDM defined.

Radim and I always agree. :)

Paolo

  reply	other threads:[~2017-08-02  8:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  2:25 [PATCH v2] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2 Wanpeng Li
2017-08-01 19:59 ` Radim Krčmář
2017-08-01 22:42   ` Wanpeng Li
2017-08-02  8:05     ` Wanpeng Li
2017-08-02  8:13       ` Paolo Bonzini [this message]
2017-08-03 13:46 ` Radim Krčmář
2017-08-04  1:23   ` Wanpeng Li
2019-10-18 21:12     ` Jim Mattson

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=09b9f160-eae2-c7a8-2405-053c7d44dbcb@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=wanpeng.li@hotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).