public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@intel.com>
To: "pbonzini@redhat.com" <pbonzini@redhat.com>,
	"seanjc@google.com" <seanjc@google.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"xuyun_xy.xy@linux.alibaba.com" <xuyun_xy.xy@linux.alibaba.com>,
	"zijie.wei@linux.alibaba.com" <zijie.wei@linux.alibaba.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/3] KVM: x86: Rescan I/O APIC routes after EOI interception for old routing
Date: Tue, 4 Mar 2025 09:54:00 +0000	[thread overview]
Message-ID: <8e99d1bf0f2ad849aae66d0b3b67d25d1a4511cb.camel@intel.com> (raw)
In-Reply-To: <20250304013335.4155703-4-seanjc@google.com>

On Mon, 2025-03-03 at 17:33 -0800, Sean Christopherson wrote:
> From: weizijie <zijie.wei@linux.alibaba.com>
> 
> Rescan I/O APIC routes for a vCPU after handling an intercepted I/O APIC
> EOI for an IRQ that is not targeting said vCPU, i.e. after handling what's
> effectively a stale EOI VM-Exit.  If a level-triggered IRQ is in-flight
> when IRQ routing changes, e.g. because the guest change routing from its
						   ^
						   changes ?

> IRQ handler, then KVM intercepts EOIs on both the new and old target vCPUs,
> so that the in-flight IRQ can be de-asserted when it's EOI'd.
> 
> However, only the EOI for the in-flight IRQ needs to intercepted, as IRQs
							^
							be intercepted

> on the same vector with the new routing are coincidental, i.e. occur only
> if the guest is reusing the vector for multiple interrupt sources.  If the
> I/O APIC routes aren't rescanned, KVM will unnecessarily intercept EOIs
> for the vector and negative impact the vCPU's interrupt performance.
> 
> Note, both commit db2bdcbbbd32 ("KVM: x86: fix edge EOI and IOAPIC reconfig
> race") and commit 0fc5a36dd6b3 ("KVM: x86: ioapic: Fix level-triggered EOI
> and IOAPIC reconfigure race") mentioned this issue, but it was considered
> a "rare" occurrence thus was not addressed.  However in real environments,
> this issue can happen even in a well-behaved guest.
> 
> Cc: Kai Huang <kai.huang@intel.com>
> Co-developed-by: xuyun <xuyun_xy.xy@linux.alibaba.com>
> Signed-off-by: xuyun <xuyun_xy.xy@linux.alibaba.com>
> Signed-off-by: weizijie <zijie.wei@linux.alibaba.com>
> [sean: massage changelog and comments, use int/-1, reset at scan]
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Kai Huang <kai.huang@intel.com>

  reply	other threads:[~2025-03-04  9:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04  1:33 [PATCH v5 0/3] KVM: x86: Optimize "stale" EOI bitmap exiting Sean Christopherson
2025-03-04  1:33 ` [PATCH v5 1/3] KVM: x86: Isolate edge vs. level check in userspace I/O APIC route scanning Sean Christopherson
2025-03-04  9:42   ` Huang, Kai
2025-04-10 22:46     ` Sean Christopherson
2025-04-10 22:55       ` Kai Huang
2025-03-04  1:33 ` [PATCH v5 2/3] KVM: x86: Add a helper to deduplicate I/O APIC EOI interception logic Sean Christopherson
2025-03-04  9:45   ` Huang, Kai
2025-03-04  1:33 ` [PATCH v5 3/3] KVM: x86: Rescan I/O APIC routes after EOI interception for old routing Sean Christopherson
2025-03-04  9:54   ` Huang, Kai [this message]
2025-04-25 22:09 ` [PATCH v5 0/3] KVM: x86: Optimize "stale" EOI bitmap exiting 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=8e99d1bf0f2ad849aae66d0b3b67d25d1a4511cb.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=xuyun_xy.xy@linux.alibaba.com \
    --cc=zijie.wei@linux.alibaba.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