From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2782AC61DD6 for ; Wed, 2 Sep 2026 15:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CtwLV0ZxcRbhB3k9lm4oQ7bIei29ZB06qlm+X3wrhWE=; b=vEQLeiHL8Yenx6VmodxIoE8gCO 7DhcE8P06q8DJj1eamofK8BoIggBoN8XzNLEm8r3T+q83Io1MLMiyZRuhT4CmKIT7gUKVqOf7LeJ+ RauFNktYoMagUij5Fc5I16JsvHVIp0w7aHSF7kPyMHfwbDfWcYKnzlm5uMWFt0LA+iN58d5KUD9zu Vv9gH5EpXsR2liio93yeL5xtZA/H0C199o5wxlx/FKoX7EM6VmlR6fdxJMhtxzkdCGCuIKKuZA7LY KFTjKqKDM2tpkv7qZs9d8suFxwBkgQcBtsUvDWGXClFT7dfJhke7Bq3iaapxHNhvvAt1SYqRhqq8S AnePlkHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1nG1-0000000F9Ck-1ikQ; Wed, 02 Sep 2026 15:52:13 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1nFy-0000000F99t-32ZD for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2026 15:52:10 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 249FB41E98; Wed, 2 Sep 2026 15:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 070611F00A3A; Wed, 2 Sep 2026 15:52:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788364330; bh=CtwLV0ZxcRbhB3k9lm4oQ7bIei29ZB06qlm+X3wrhWE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=L7frCOZHBDZgspABs25rR9/5PzJbIOD/Wi5/zPdK9aT7HMa0AdbHS5M02p6CMLJli 9gBkIOsJteCdyOVJEvPUE0SH9YzUKod2Rc/2iCSzm1kckKIf81idDCwpguBsiqudpl +fsFwhRl7sXwC5bgUh3KLt6jeTwDao2jmHJ+gifBP5/X5AYaD6qv61QU793a5uSEsz wWZGBHYIVBYSOBjG4l5iOYRbYy8ZCeBPUbiurVnSjGtK54WEXJNtuc54v8hcK1Z0Ju 1Uwh16XMCxuA90jJoHg4c836nke6280oDHQJFZF1P6L1PoZw4SOO4Ilvbn3sCL+HoY nUvy8D18QLW8A== 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 1x1nFv-00000003xHP-3iCe; Wed, 02 Sep 2026 15:52:08 +0000 Date: Wed, 02 Sep 2026 16:54:41 +0100 Message-ID: <87fqzrmywu.wl-maz@kernel.org> From: Marc Zyngier To: Jiangshan Yi Cc: lpieralisi@kernel.org, tglx@kernel.org, radu@rendec.net, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, 13667453960@163.com Subject: Re: [PATCH] irqchip/gic-v5: Install root IRQ handler last in gicv5_init_common() In-Reply-To: <20260902143255.182786-1-yijiangshan@kylinos.cn> References: <20260902143255.182786-1-yijiangshan@kylinos.cn> 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) 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: yijiangshan@kylinos.cn, lpieralisi@kernel.org, tglx@kernel.org, radu@rendec.net, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, 13667453960@163.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 02 Sep 2026 15:32:55 +0100, Jiangshan Yi wrote: > > set_handle_irq() is irreversible: once installed, handle_arch_irq > points at gicv5_handle_irq, which dereferences the PPI/SPI/LPI > irqdomains. If gicv5_irs_enable() fails afterwards, the error path > calls gicv5_free_domains() while handle_arch_irq still references > those domains. I don't think that's a massive problem. If you can't enable the IRS, you can't do much at all. Your system is already completely dead. > > Move set_handle_irq() after gicv5_irs_enable() so the handler is > only installed once all fallible steps have succeeded. Drop the > no-op set_handle_irq(NULL) in the error path, which never worked > because set_handle_irq() returns -EBUSY once a handler is set. That is a reasonable cleanup. > > Fixes: 183750b276c2 ("irqchip/gic-v5: Fix gicv5_init_common() error paths") > Signed-off-by: Jiangshan Yi > --- > drivers/irqchip/irq-gic-v5.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v5.c b/drivers/irqchip/irq-gic-v5.c > index ac2d423b1723..37184942dc11 100644 > --- a/drivers/irqchip/irq-gic-v5.c > +++ b/drivers/irqchip/irq-gic-v5.c > @@ -1166,21 +1166,19 @@ static int __init gicv5_init_common(struct fwnode_handle *parent_domain) > if (ret) > goto out_int; > > - ret = set_handle_irq(gicv5_handle_irq); > + ret = gicv5_irs_enable(); > if (ret) > goto out_int; > > - ret = gicv5_irs_enable(); > + ret = set_handle_irq(gicv5_handle_irq); > if (ret) > - goto out_handle; > + goto out_int; Under which circumstance can this fail? There should be none. So if this ever returns an error, we should immediately stop with a panic. No need to clean anything up, just die on the spot. > > gicv5_smp_init(); > > gicv5_irs_its_probe(); > return 0; > > -out_handle: > - set_handle_irq(NULL); > out_int: > gicv5_cpu_disable_interrupts(); > gicv5_free_domains(); Thanks, M. -- Jazz isn't dead. It just smells funny.