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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 814CBC433EF for ; Fri, 22 Oct 2021 10:38:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C6F361208 for ; Fri, 22 Oct 2021 10:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232613AbhJVKko (ORCPT ); Fri, 22 Oct 2021 06:40:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:35344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbhJVKkn (ORCPT ); Fri, 22 Oct 2021 06:40:43 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BC8C61108; Fri, 22 Oct 2021 10:38:26 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mdrwN-000txL-Uw; Fri, 22 Oct 2021 11:38:24 +0100 Date: Fri, 22 Oct 2021 11:38:23 +0100 Message-ID: <87mtn1bazk.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland Cc: linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, catalin.marinas@arm.com, deanbo422@gmail.com, green.hu@gmail.com, guoren@kernel.org, jonas@southpole.se, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, nickhu@andestech.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tglx@linutronix.de, torvalds@linux-foundation.org, tsbogend@alpha.franken.de, vgupta@kernel.org, will@kernel.org Subject: Re: [PATCH 01/15] irq: mips: avoid nested irq_enter() In-Reply-To: <20211021180236.37428-2-mark.rutland@arm.com> References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-2-mark.rutland@arm.com> 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/27.1 (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: 185.219.108.64 X-SA-Exim-Rcpt-To: mark.rutland@arm.com, linux-kernel@vger.kernel.org, aou@eecs.berkeley.edu, catalin.marinas@arm.com, deanbo422@gmail.com, green.hu@gmail.com, guoren@kernel.org, jonas@southpole.se, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, nickhu@andestech.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tglx@linutronix.de, torvalds@linux-foundation.org, tsbogend@alpha.franken.de, vgupta@kernel.org, will@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Oct 2021 19:02:22 +0100, Mark Rutland wrote: > > As bcm6345_l1_irq_handle() is a chained irqchip handler, it will be > invoked within the context of the root irqchip handler, which must have > entered IRQ context already. > > When bcm6345_l1_irq_handle() calls arch/mips's do_IRQ() , this will nest > another call to irq_enter(), and the resulting nested increment to > `rcu_data.dynticks_nmi_nesting` will cause rcu_is_cpu_rrupt_from_idle() > to fail to identify wakeups from idle, resulting in failure to preempt, > and RCU stalls. > > Chained irqchip handlers must invoke IRQ handlers by way of thee core > irqchip code, i.e. generic_handle_irq() or generic_handle_domain_irq() > and should not call do_IRQ(), which is intended only for root irqchip > handlers. > > Fix bcm6345_l1_irq_handle() by calling generic_handle_irq() directly. > > Fixes: c7c42ec2baa1de7a ("irqchips/bmips: Add bcm6345-l1 interrupt controller") > Signed-off-by: Mark Rutland > Cc: Marc Zyngier > Cc: Thomas Bogendoerfer > Cc: Thomas Gleixner > --- > drivers/irqchip/irq-bcm6345-l1.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c > index e3483789f4df..1bd0621c4ce2 100644 > --- a/drivers/irqchip/irq-bcm6345-l1.c > +++ b/drivers/irqchip/irq-bcm6345-l1.c > @@ -140,7 +140,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc) > for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) { > irq = irq_linear_revmap(intc->domain, base + hwirq); > if (irq) > - do_IRQ(irq); > + generic_handle_irq(irq); > else > spurious_interrupt(); > } A marginally better fix would be to have: diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c index 1bd0621c4ce2..fd079215c17f 100644 --- a/drivers/irqchip/irq-bcm6345-l1.c +++ b/drivers/irqchip/irq-bcm6345-l1.c @@ -132,16 +132,12 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc) int base = idx * IRQS_PER_WORD; unsigned long pending; irq_hw_number_t hwirq; - unsigned int irq; pending = __raw_readl(cpu->map_base + reg_status(intc, idx)); pending &= __raw_readl(cpu->map_base + reg_enable(intc, idx)); for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) { - irq = irq_linear_revmap(intc->domain, base + hwirq); - if (irq) - generic_handle_irq(irq); - else + if (generic_handle_domain_irq(intc->domain, base + hwirq)) spurious_interrupt(); } } but we can also tackle that separately if you'd rather keep the change minimal. M. -- Without deviation from the norm, progress is not possible.