public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
	Wanpeng Li <wanpeng.li@hotmail.com>
Subject: Re: [PATCH v3] KVM: nVMX: Fix attempting to emulate "Acknowledge interrupt on exit" when there is no interrupt which L1 requires to inject to L2
Date: Thu, 3 Aug 2017 14:30:20 +0200	[thread overview]
Message-ID: <20170803123020.GA1015@flask> (raw)
In-Reply-To: <CANRm+CzTh2Vc+6QRxPq4hfKYuybNsQSjK0kdhHze72S9OtaPfQ@mail.gmail.com>

2017-08-03 07:01+0800, Wanpeng Li:
> 2017-08-03 4:26 GMT+08:00 Radim Krčmář <rkrcmar@redhat.com>:
> > 2017-08-02 03:48-0700, Wanpeng Li:
> >> From: Wanpeng Li <wanpeng.li@hotmail.com>
> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> >> @@ -10761,7 +10761,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))) &&
> >
> > I think it would be safer to also add something like the second hunk I
> > posted (that also takes nested_exit_on_intr() into account).
> >
> > The issue is that we're allowing L2's GUEST_RFLAGS and
> > GUEST_INTERRUPTIBILITY_INFO to disable userspace interrupt injection
> > even though neither affect delivery of interrupts into L1.
> > This means that L2 can block/postpone the delivery to L1 by doing "cli;
> > busy_loop/normal_critical_section".
> 
> Ouch! My fault, the v3 patch w/o the second hunk and w/ the second
> hunk both can result in L1 guest softlockup. I just tested the patch
> with L2 windows guest yesterday, however, the softlockup can happen
> when the L2 is the linux guest. So should we still take the v2 for the
> moment?

Sure, that one is an improvement over the current situation (I guess it
doesn't break any hypervisor).
I'll just add a comment about its incorrectness.

      reply	other threads:[~2017-08-03 12:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 10:48 [PATCH v3] 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-02 20:26 ` Radim Krčmář
2017-08-02 23:01   ` Wanpeng Li
2017-08-03 12:30     ` 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=20170803123020.GA1015@flask \
    --to=rkrcmar@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@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