From: David Woodhouse <dwmw2@infradead.org>
To: Adamos Ttofari <attofari@amazon.de>, Thomas Huth <thuth@redhat.com>
Cc: "Sean Christopherson" <seanjc@google.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Nikita Leshenko" <nikita.leshchenko@oracle.com>,
"Liran Alon" <liran.alon@oracle.com>,
"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: ioapic: Fix level-triggered EOI and userspace IOAPIC reconfigure race
Date: Wed, 07 Dec 2022 09:42:15 +0000 [thread overview]
Message-ID: <d0f915ddd337ae3ce6ecb19f7d5f3faa6980b1de.camel@infradead.org> (raw)
In-Reply-To: <20221207091324.89619-1-attofari@amazon.de>
[-- Attachment #1: Type: text/plain, Size: 1675 bytes --]
On Wed, 2022-12-07 at 09:13 +0000, Adamos Ttofari wrote:
> When split-irqchip is used KVM uses ioapic_handled_vectors to identify
> which vectors require an exit to userspace IOAPIC. Unfortunately, when the
> IOAPIC is reconfigured while the interrupt is being handled, it will use
> the newest configuration; therefore, the EOI will not be delivered to
> IOAPIC.
>
> A previous commit 0fc5a36dd6b3
> ("KVM: x86: ioapic: Fix level-triggered EOI and IOAPIC reconfigure race")
> fixed the race for kernel ioapic, but the issue still persists for
> userspace IOAPIC:
>
> 1) Userspace IOAPIC sends a level triggered interrupt to VCPU0.
> 2) VCPU0's handler reconfigures the IOAPIC to route the interrupts to
> VCPU1. (This can cause userspace IOAPIC to commit a new routing table,
> eventually leading KVM to unset the vector in ioapic_handled_vectors)
> 3) VCPU0 triggers an EOI, and it's not delivered to userspace IOAPIC
> because the vector bit is not set in ioapic_handled_vectors.
> 4) The loss of EOI, leaves remote_irr in IOAPIC set. Eventually blocking
> new interrupts.
>
> To avoid the above scenario, we should apply a similar fix like
> commit 0fc5a36dd6b3 ("KVM: x86: ioapic: Fix level-triggered EOI and IOAPIC
> reconfigure race") Which is to add all pending and running vectors to
> ioapic_handled_vectors.
>
> Fixes: 0fc5a36dd6b3 ("KVM: x86: ioapic: Fix level-triggered EOI and IOAPIC reconfigure race")
>
> Signed-off-by: Adamos Ttofari <attofari@amazon.de>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Thanks.
This should fix https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/issues/1
shouldn't it?
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]
next prev parent reply other threads:[~2022-12-07 9:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 9:13 Adamos Ttofari
2022-12-07 9:42 ` David Woodhouse [this message]
2022-12-07 16:13 ` Sean Christopherson
2022-12-08 9:44 ` [PATCH v2] KVM: x86: ioapic: Fix level-triggered EOI and userspace I/OAPIC " Adamos Ttofari
2022-12-09 1:34 ` Sean Christopherson
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=d0f915ddd337ae3ce6ecb19f7d5f3faa6980b1de.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=attofari@amazon.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liran.alon@oracle.com \
--cc=mingo@redhat.com \
--cc=nikita.leshchenko@oracle.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thuth@redhat.com \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®