[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d0f915ddd337ae3ce6ecb19f7d5f3faa6980b1de.camel@infradead.org>
Date: Wed, 07 Dec 2022 09:42:15 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Adamos Ttofari <attofari@...zon.de>, Thomas Huth <thuth@...hat.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Nikita Leshenko <nikita.leshchenko@...cle.com>,
Liran Alon <liran.alon@...cle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Radim Krčmář <rkrcmar@...hat.com>,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: ioapic: Fix level-triggered EOI and userspace
IOAPIC reconfigure race
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@...zon.de>
Reviewed-by: David Woodhouse <dwmw@...zon.co.uk>
Thanks.
This should fix https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/issues/1
shouldn't it?
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists