Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp765798rdb; Tue, 19 Sep 2023 09:28:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhqravflR6hecIOVi2WpOKN5dQyvNdi00m7ch2/4mfKTx/vZujb2LOT6Gl9fLAiF0m9R7j X-Received: by 2002:a17:903:249:b0:1b8:2ba0:c9c0 with SMTP id j9-20020a170903024900b001b82ba0c9c0mr13584131plh.59.1695140889144; Tue, 19 Sep 2023 09:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695140889; cv=none; d=google.com; s=arc-20160816; b=kte85Zc6tvPvs8+aoJ4eCjXF9lrHeVG/hkreP3NC3U/7FJDrh+Sor+EVx6bc53/Vl4 h/qjVfpBzgIkxWt64oHaHJZ1c/OFY8E72Gt7RGRoGoHyrnuXTebY0UGtaXZ2YLi9pFtc mYjvihBF2/TLXjjxbuw9KJQ1pEnQXt8Df4DJWgUFSRwvY4Q6jIXT5gFCCFwvY7iVzyw1 Z8YpCs6scc9RQme573uVgHKUreWPfP4VHssYK72bNS5j3OYtLmwivcEShSRki8Puz5j6 3dyM6p0kwegkRzMKhXWi8jISi/AddTbMyGBjaohN65rVCmTXPJaFyofeDFbolVV/Zy48 /ViA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=s7u9dLSby6ICSyyEmstZvkol7BhjpmAXW/JXcPJWP0w=; fh=SkpZksHjzZAw08SQ4GWYM1zwE4MQe+gVw/De8CatwzE=; b=eef+E14i+6fg37dr7XsnJbSqek40HxLPgTeGv6cYgqxAtmGmSLauUBVj1eceGP03U8 bzT7DtlBRCgwl8IpKYK/vt99eWFbeTk9z5nTyspKOCXjHUFX/NZWVEUK9/ARO+qafaLd UGBTYLamcM8S0vTLJE0bgfOV6Wi1C1k9m+PXLGcMHmULecbzEa08l/2q79SbuJE2KyLp A/cGXMNu1EUjZcbfrp7K3aD5CXqqa6G5YlcL0bb0ZLtT2oqe97mcApFAq4I2dqNoGmKJ R9VW2J41fjfgQgIEDaW/rvJuM25hXI7iG047uPNQwBy5eeXNiTNvq5fNm7X9tKHNGGe4 3bQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nd74LZGB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id p18-20020a170902e75200b001c1f373ea07si2841524plf.351.2023.09.19.09.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 09:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nd74LZGB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1403381F330C; Tue, 19 Sep 2023 09:19:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbjISQTT (ORCPT + 99 others); Tue, 19 Sep 2023 12:19:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbjISQTP (ORCPT ); Tue, 19 Sep 2023 12:19:15 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BACB3A1; Tue, 19 Sep 2023 09:19:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53599C433C8; Tue, 19 Sep 2023 16:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695140349; bh=8JMiQ5M7/KIEk98IyOcUQVbopzZnILgjqlCPUZv+KTo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nd74LZGBcan2JhY4lwNiP+y/ZbV2GqaFOfVUh5npk8AQyl/PgmtPsCNqDWfpcEN1j 3oWaUMoMoTuH7keKvAr9e/KHPDBxEbM9sVgN+XE7XXK0MarIjUGTLDPJKPICpM9c25 HaCwKOXcxMmmWM9uK+Ho+hBAbXmJ+d4DrRqtU2STV90XzTEnqm44cJMafFYu/NkYTP wpfwv9O17yYVnCQXqxcvcUkASooeeqwf/KS9pRBdXnmmYYxfuwY0RMr+E2wnfmSQz8 Mucm63CCnmE0tzVbGn6QJF+ZJsIzDSZ4NSgj7YHrMowMN4ifFqr480njZGiy9r6PwA STvh5OaE26s7g== Received: from [104.132.45.96] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qidRK-00EOAg-TX; Tue, 19 Sep 2023 17:19:07 +0100 Date: Tue, 19 Sep 2023 17:19:05 +0100 Message-ID: <87cyye3zly.wl-maz@kernel.org> From: Marc Zyngier To: Biju Das Cc: Thomas Gleixner , Prabhakar Mahadev Lad , Claudiu Beznea , Geert Uytterhoeven , Biju Das , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" Subject: Re: [PATCH 3/3] irqchip: renesas-rzg2l: Fix irq storm with edge trigger detection for TINT In-Reply-To: References: <20230918122411.237635-1-biju.das.jz@bp.renesas.com> <20230918122411.237635-4-biju.das.jz@bp.renesas.com> <86y1h2cjpb.wl-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/28.2 (x86_64-pc-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: 104.132.45.96 X-SA-Exim-Rcpt-To: biju.das.jz@bp.renesas.com, tglx@linutronix.de, prabhakar.mahadev-lad.rj@bp.renesas.com, claudiu.beznea.uj@bp.renesas.com, geert+renesas@glider.be, biju.das.au@gmail.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 19 Sep 2023 09:19:21 -0700 (PDT) On Tue, 19 Sep 2023 16:24:53 +0100, Biju Das wrote: > > Hi Marc Zyngier, > > Thanks for the feedback. > > > Subject: Re: [PATCH 3/3] irqchip: renesas-rzg2l: Fix irq storm with edge > > trigger detection for TINT > > > > On Mon, 18 Sep 2023 13:24:11 +0100, > > Biju Das wrote: > > > > > > In case of edge trigger detection, enabling the TINT source causes a > > > phantum interrupt that leads to irq storm. So clear the phantum > > > interrupt in rzg2l_irqc_irq_enable(). > > > > > > This issue is observed when the irq handler disables the interrupts > > > using > > > disable_irq_nosync() and scheduling a work queue and in the work > > > queue, re-enabling the interrupt with enable_irq(). > > > > > > Fixes: 3fed09559cd8 ("irqchip: Add RZ/G2L IA55 Interrupt Controller > > > driver") > > > Signed-off-by: Biju Das > > > Tested-by: Claudiu Beznea > > > --- > > > drivers/irqchip/irq-renesas-rzg2l.c | 6 ++++++ > > > 1 file changed, 6 insertions(+) > > > > > > diff --git a/drivers/irqchip/irq-renesas-rzg2l.c > > > b/drivers/irqchip/irq-renesas-rzg2l.c > > > index 33a22bafedcd..78a9e90512a6 100644 > > > --- a/drivers/irqchip/irq-renesas-rzg2l.c > > > +++ b/drivers/irqchip/irq-renesas-rzg2l.c > > > @@ -144,6 +144,12 @@ static void rzg2l_irqc_irq_enable(struct irq_data > > *d) > > > reg = readl_relaxed(priv->base + TSSR(tssr_index)); > > > reg |= (TIEN | tint) << TSSEL_SHIFT(tssr_offset); > > > writel_relaxed(reg, priv->base + TSSR(tssr_index)); > > > + /* > > > + * In case of edge trigger detection, enabling the TINT source > > > + * cause a phantum interrupt that leads to irq storm. So clear > > > + * the phantum interrupt. > > > + */ > > > + rzg2l_tint_eoi(d); > > > > This looks incredibly unsafe. disable_irq()+enable_irq() with an interrupt > > being made pending in the middle, and you've lost that interrupt. > > In this driver that will never happen as it clears the TINT source > during disable(), so there won't be any TINT source for interrupt > detection after disable(). So you mean that you *already* lose interrupts across a disable followed by an enable? I'm slightly puzzled... M. -- Without deviation from the norm, progress is not possible.