All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Sean Christopherson <seanjc@google.com>
Cc: kvm <kvm@vger.kernel.org>, "Sironi, Filippo" <sironi@amazon.de>,
	"Raslan, KarimAllah" <karahmed@amazon.de>,
	Matt Gingell <gingell@google.com>,
	Steve Rutherford <srutherford@google.com>,
	liran@amazon.com
Subject: Re: [RFC PATCH] Fix split-irqchip vs interrupt injection window request.
Date: Thu, 26 Nov 2020 18:59:49 +0100	[thread overview]
Message-ID: <26940473-6bd0-fc2b-f9bd-35a6a502baff@redhat.com> (raw)
In-Reply-To: <95c0c9a01ea9692b3b18ac677d7e7c6e7636bfe4.camel@infradead.org>

On 26/11/20 18:29, David Woodhouse wrote:
> On Thu, 2020-11-26 at 11:10 +0000, David Woodhouse wrote:
>>
>>> whether or not there's an IRQ in the
>>> LAPIC should be irrelevant when deciding to exit to userspace.  Note, the
>>> reinjection check covers vcpu->arch.interrupt.injected for the case where LAPIC
>>> is in userspace.
>>>
>>>          return kvm_arch_interrupt_allowed(vcpu) &&
>>>                 (!lapic_in_kernel(vcpu) || !kvm_cpu_has_extint(vcpu)) &&
>>>                 !kvm_event_needs_reinjection(vcpu) &&
>>>                 kvm_cpu_accept_dm_intr(vcpu);
>>> }
>>
>> Makes sense. I'm putting this version through some testing and will
>> post it later...
> 
> Hm, that survived enough test iterations to persuade me to post it, but
> then seems to have fallen over later. I'm reverting to the
> kvm_cpu_has_injectable_intr() version to leave that one running too and
> be sure it's gone in that.

!kvm_cpu_has_injectable_intr(vcpu) boils down (assuming no nested virt) to

         if (!lapic_in_kernel(v))
                 return !v->arch.interrupt.injected;

         if (kvm_cpu_has_extint(v))
                 return 0;

         return 1;

and Sean's proposal instead is the same indeed (the first "if" doesn't 
matter), so there may be more than one bug.

But it turns out that with some more inlining and Boolean algebra, we 
can actually figure out what the code does. :)  I had just finished 
writing a looong review of your patch starting from that idea, so I'll 
post it.

Paolo


  reply	other threads:[~2020-11-26 18:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 13:03 [RFC] Further hack request_interrupt_window handling to work around kvm_cpu_has_interrupt() nesting breakage David Woodhouse
2020-11-25 15:10 ` [RFC PATCH] Fix split-irqchip vs interrupt injection window request David Woodhouse
2020-11-25 21:19   ` Sean Christopherson
2020-11-26 11:10     ` David Woodhouse
2020-11-26 12:05       ` [PATCH] kvm/x86: Fix simultaneous ExtINT and lapic interrupt handling with APICv David Woodhouse
2020-11-26 18:00         ` Paolo Bonzini
2020-11-26 19:07           ` David Woodhouse
2020-11-26 17:29       ` [RFC PATCH] Fix split-irqchip vs interrupt injection window request David Woodhouse
2020-11-26 17:59         ` Paolo Bonzini [this message]
2020-11-26 21:48           ` David Woodhouse
2020-11-27  4:37             ` Paolo Bonzini

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=26940473-6bd0-fc2b-f9bd-35a6a502baff@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=gingell@google.com \
    --cc=karahmed@amazon.de \
    --cc=kvm@vger.kernel.org \
    --cc=liran@amazon.com \
    --cc=seanjc@google.com \
    --cc=sironi@amazon.de \
    --cc=srutherford@google.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.