* [PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4
@ 2026-11-09 11:20 Jinqian Yang
2026-11-09 17:04 ` Oliver Upton
0 siblings, 1 reply; 2+ messages in thread
From: Jinqian Yang @ 2026-11-09 11:20 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, kvmarm
Cc: maz, oupton, fuad.tabba, yuzenghui, joey.gouly, seiden,
suzuki.poulose, yangjinqian1, liuyonglong, wangzhou1, prime.zeng,
tangchengchang, zhengtian10, linuxarm, liujian222
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4
2026-11-09 11:20 [PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4 Jinqian Yang
@ 2026-11-09 17:04 ` Oliver Upton
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Upton @ 2026-11-09 17:04 UTC (permalink / raw)
To: Jinqian Yang
Cc: linux-kernel, linux-arm-kernel, kvmarm, maz, fuad.tabba,
yuzenghui, joey.gouly, seiden, suzuki.poulose, liuyonglong,
wangzhou1, prime.zeng, tangchengchang, zhengtian10, linuxarm,
liujian222
Hi,
On Mon, Nov 09, 2026 at 07:20:18PM +0800, Jinqian Yang wrote:
> 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;
> }
This should just take a pointer on struct kvm then use
vgic_supports_direct_msis() since having an initialized irqchip is a
precondition of kvm_irqfd_assign().
Thanks,
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-09 17:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 11:20 [PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4 Jinqian Yang
2026-11-09 17:04 ` Oliver Upton
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®