From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 469C5345CD0; Fri, 24 Apr 2026 07:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777015486; cv=none; b=eOrSzSGjNLcre9cD90w0LMfkfC23H7l1XCK6Nsekjf5ZQG1GSgTj4PFZKfHPbQAXN0CXHsRz5X05mTNKCB2zuiYshzA4+YtkIbsm66bOUPbvvKYoteNKrzYa22LNvhTs/UJqb2lz981HzVF6SP+iCW2A/Qg1a5+u7/Z+GpWOAaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777015486; c=relaxed/simple; bh=6mVWuteGVpQy8M878VFdWu6XkCt5gpyOdVPcDnaHa8s=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=pQqhVi90bgK5q8YfhkdP8/T6UJvDc4RyiUUsVSQ7zB8Hu2eTxSVy0qOS6Kifwlb+ok3R5GSo2cCEg6KCqW5Wxd/B1Q4rG68Dwtpb+pBLU4kZPoBzqL5wuC60doWjcMW76S3ye5DRVp+sbsgfnA8BGvUNQeCHRCABzUlQXzSqO80= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sfxfy4wt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sfxfy4wt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 207FFC19425; Fri, 24 Apr 2026 07:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777015486; bh=6mVWuteGVpQy8M878VFdWu6XkCt5gpyOdVPcDnaHa8s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sfxfy4wtCPyxDjviJPdNUMQ0DmV/qDZ05+48OVbM7hViSb6pq7JQkNHZHhS7T9YqN kYEvgoVakwXR0kwBU2v63u5Y04J9IWsmLukn3u6Su88OCwSTeLt7RzIv2EWaK6ImsT 9423m0qMPrVJdbqqz6futIDiJWdQtOlQ6RZISFBzXdC6jdNMoZfw6WZcXPHR2jqP9+ YZS0Zj49PmXVNv5/qdBbNw7kOSTU8ogLg+PDcvvK3+WOshPfCIqIDQSTszZL3fZDXv 5wTxLDKNGhbuRaIRmkdowf/NuROQz4kidg19G4fbqn2iDxbmjvXgR97OnBFuhDbxFt f/MiYL6q75ONQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wGAu3-0000000EI9I-0fWL; Fri, 24 Apr 2026 07:24:43 +0000 Date: Fri, 24 Apr 2026 08:24:42 +0100 Message-ID: <87jytwbz2d.wl-maz@kernel.org> From: Marc Zyngier To: Yao Yuan Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: Re: [PATCH] KVM: arm64: Wake-up from WFI when iqrchip is in userspace In-Reply-To: References: <20260423163607.486345-1-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: yaoyuan@linux.alibaba.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, joey.gouly@arm.com, suzuki.poulose@arm.com, oupton@kernel.org, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 24 Apr 2026 07:33:02 +0100, Yao Yuan 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 > > --- > > 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.