public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Yao Yuan <yaoyuan@linux.alibaba.com>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Oliver Upton <oupton@kernel.org>,
	Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH] KVM: arm64: Wake-up from WFI when iqrchip is in userspace
Date: Fri, 24 Apr 2026 08:24:42 +0100	[thread overview]
Message-ID: <87jytwbz2d.wl-maz@kernel.org> (raw)
In-Reply-To: <uhqgyol622go4lm5btbk4jyieb3swhskpkyel4mnksfeki2mo2@ecnjvxwiqcfw>

On Fri, 24 Apr 2026 07:33:02 +0100,
Yao Yuan <yaoyuan@linux.alibaba.com> wrote:
> 
> On Thu, Apr 23, 2026 at 05:36:07PM +0800, Marc Zyngier wrote:
> > It appears that there is nothing in the wake-up path that
> > evaluates whether the in-kernel interrupts are pending unless
> > we have a vgic.
> >
> > This means that the userspace irqchip support has been broken for
> > about four years, and nobody noticed. It was also broken before
> > as we wouldn't wake-up on a PMU interrupt, but hey, who cares...
> >
> > It is probably time to remove the feature altogether, because it
> > was a terrible idea 10 years ago, and it still is.
> >
> > Fixes: b57de4ffd7c6d ("KVM: arm64: Simplify kvm_cpu_has_pending_timer()")
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> >  arch/arm64/kvm/arm.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
> > index 176cbe8baad30..8bb2c7422cc8b 100644
> > --- a/arch/arm64/kvm/arm.c
> > +++ b/arch/arm64/kvm/arm.c
> > @@ -824,6 +824,10 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
> >  {
> >  	bool irq_lines = *vcpu_hcr(v) & (HCR_VI | HCR_VF | HCR_VSE);
> >
> 
> Hi Marc,
> 
> > +	irq_lines |= (!irqchip_in_kernel(v->kvm) &&
> > +		      (kvm_timer_should_notify_user(v) ||
> > +		       kvm_pmu_should_notify_user(v)));
> 
> How about a new helper like 'kvm_should_notify_us_irqchip()' ?
> We can replace the same part at beginning of kvm_vcpu_exit_request() and
> here w/ unlikely().

I'd rather not introduce a helper, for two reasons:

- this needs to be backported all the way to 5.19, because that's how
  far it has been broken. So keeping it small and localised is far
  better than introducing a helper that will make the backport less
  obvious.

- I have patches to remove the other calls to kvm_*_notify_user() as a
  simplification of this utterly stupid feature.

Finally, and while I agree that this could take an unlikely()
qualifier, a much better course of action would be to have a separate
patch that moves the qualifier to the predicate itself.

Thanks,

	M.

-- 
Jazz isn't dead. It just smells funny.


  reply	other threads:[~2026-04-24  7:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 16:36 [PATCH] KVM: arm64: Wake-up from WFI when iqrchip is in userspace Marc Zyngier
2026-04-24  6:33 ` Yao Yuan
2026-04-24  7:24   ` Marc Zyngier [this message]
2026-04-24 11:08 ` Marc Zyngier

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=87jytwbz2d.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=oupton@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=yaoyuan@linux.alibaba.com \
    --cc=yuzenghui@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