mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@kernel.org>
To: Jinqian Yang <yangjinqian1@huawei.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	maz@kernel.org, fuad.tabba@linux.dev, yuzenghui@huawei.com,
	joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com,
	liuyonglong@huawei.com, wangzhou1@hisilicon.com,
	prime.zeng@hisilicon.com, tangchengchang@huawei.com,
	zhengtian10@huawei.com, linuxarm@huawei.com,
	liujian222@huawei.com
Subject: Re: [PATCH] KVM: arm64: Register irq_bypass consumers only with GICv4
Date: Mon, 9 Nov 2026 09:04:40 -0800	[thread overview]
Message-ID: <avH9KJ99im5Z2wEb@kernel.org> (raw)
In-Reply-To: <20261109112018.241298-1-yangjinqian1@huawei.com>

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

      reply	other threads:[~2026-11-09 17:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 11:20 Jinqian Yang
2026-11-09 17:04 ` Oliver Upton [this message]

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=avH9KJ99im5Z2wEb@kernel.org \
    --to=oupton@kernel.org \
    --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=prime.zeng@hisilicon.com \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tangchengchang@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=yangjinqian1@huawei.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®