From: Jinqian Yang <yangjinqian1@huawei.com>
To: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <kvmarm@lists.linux.dev>
Cc: <maz@kernel.org>, <oupton@kernel.org>, <fuad.tabba@linux.dev>,
<yuzenghui@huawei.com>, <joey.gouly@arm.com>,
<seiden@linux.ibm.com>, <suzuki.poulose@arm.com>,
<yangjinqian1@huawei.com>, <liuyonglong@huawei.com>,
<wangzhou1@hisilicon.com>, <prime.zeng@hisilicon.com>,
<tangchengchang@huawei.com>, <zhengtian10@huawei.com>,
<linuxarm@huawei.com>, <liujian222@huawei.com>
Subject: [PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4
Date: Mon, 9 Nov 2026 19:20:18 +0800 [thread overview]
Message-ID: <20261109112018.241298-1-yangjinqian1@huawei.com> (raw)
kvm_arch_has_irq_bypass() on arm64 returns true unconditionally, so
every irqfd assignment registers an irq_bypass consumer even when the
hardware cannot perform GICv4 direct MSI forwarding. In that case
kvm_vgic_v4_set_forwarding() bails out at its very first check, since
vgic_supports_direct_msis() is false without has_gicv4, and the
registration becomes pure overhead: every KVM_IRQFD ioctl takes the
global irq_bypass mutex, which becomes a contention point when many
VMs boot concurrently.
Gate the registration on kvm_vgic_global_state.has_gicv4, the way x86
gates on enable_device_posted_irqs. Functionally this is a no-op:
without GICv4 the consumer registration never did anything beyond
acquiring the lock. On a GICv3-only host booting 100 microVMs
concurrently this cuts the average boot time by ~5 ms, matching the
gain observed with CONFIG_HAVE_KVM_IRQ_BYPASS=n.
Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com>
---
arch/arm64/include/asm/kvm_host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 97332ffcb130..785d57388032 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -1744,7 +1744,7 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val);
static inline bool kvm_arch_has_irq_bypass(void)
{
- return true;
+ return kvm_vgic_global_state.has_gicv4;
}
void kvm_idregs_enforce_dependencies(struct kvm *kvm);
--
2.33.0
next reply other threads:[~2026-11-09 11:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 11:20 Jinqian Yang [this message]
2026-11-09 17:04 ` Oliver Upton
2026-11-10 1:07 ` Jinqian Yang
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=20261109112018.241298-1-yangjinqian1@huawei.com \
--to=yangjinqian1@huawei.com \
--cc=fuad.tabba@linux.dev \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=liujian222@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=prime.zeng@hisilicon.com \
--cc=seiden@linux.ibm.com \
--cc=suzuki.poulose@arm.com \
--cc=tangchengchang@huawei.com \
--cc=wangzhou1@hisilicon.com \
--cc=yuzenghui@huawei.com \
--cc=zhengtian10@huawei.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
all inboxes | Powered by JetHome®