Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6018305ybv; Wed, 12 Feb 2020 04:37:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxoHs9dwoBcfOWpX4JVp36Zt8Z/FV3EsFShGA7sF0tWHujzUBfFzYu4+6TR9Bz6TUZ39Pj7 X-Received: by 2002:a05:6808:8d0:: with SMTP id k16mr6050438oij.68.1581511041227; Wed, 12 Feb 2020 04:37:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581511041; cv=none; d=google.com; s=arc-20160816; b=xKtVv3xIffi6uGJKvWUaBmPKKNPvz1AQkPkrsH0aKf/K5DvuS3b6I32KauqvJcjm0F xXox0Ew7oHfuk6/lS7fm/PYpAax7RiZp7UcWsHjZ2G5Cacvzio2zo6/QVK7NoBslkWW0 v+giTf2PZPA4R0ZKIvliFxJcCi17j6NnHXVxxMacEENdSneqcKVQvrxDt2dncR+5nX17 Sbi64j2vCBiDpopNoSsoX7GXEmLNOlp7xmjQijkBDi4mE0nDikUQ/khoQ+y8QJaDZE/f 8zZEh4kQYwNalZfpBQsYXkvLq+hGNpaD16rVcAX+UQtm+qf6imY6lB1R9ScpUCZDAp2R pM/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:message-id:subject:cc:to:from:date; bh=cUjSg/f37gAop0+iWsOKBt9dzhbMDWgdXnufFtcysFc=; b=TPtJ2I0/d1RjD5WksKUt1V2UV2eKCMsDobHX3BEXBRvzAuTr/cX0a7MAW5sHyYeSCx lN5R7VEUzC0oa3Gn/8qRZOKWO9cBz/kAdSLuSon+2R6nEpyUwrzK58hBKY8YtsPr1Eny +bEFXhuQMob7CQoFrk8lDvt2LxF6Eg8FsXYZcWPgUq4nvV/IMD7juphUj1lp1ijs55pN QI/um/SRSg4gyFvj4E5pNrdRMEfGuCYAnnWqDki8y430ceXmPdaph3OWvCEE6poDixh4 h9oOBiVkgQ/YDPRlA/AR1OJxwcbdG1UlnHhPkp9rLkAcKADPQu/0MkQOwqV0p0m+4IRC 6ooQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8si150484otp.79.2020.02.12.04.37.08; Wed, 12 Feb 2020 04:37:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727555AbgBLMgy (ORCPT + 99 others); Wed, 12 Feb 2020 07:36:54 -0500 Received: from bmailout3.hostsharing.net ([176.9.242.62]:32887 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbgBLMgy (ORCPT ); Wed, 12 Feb 2020 07:36:54 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 8C351100B0156; Wed, 12 Feb 2020 13:36:51 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 2E768228065; Wed, 12 Feb 2020 13:36:51 +0100 (CET) Date: Wed, 12 Feb 2020 13:36:51 +0100 From: Lukas Wunner To: Marc Zyngier , Florian Fainelli Cc: Thomas Gleixner , Jason Cooper , Nicolas Saenz Julienne , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Serge Schneider , Kristina Brooks , Stefan Wahren , Matthias Brugger , Martin Sperl , Phil Elwell Subject: Re: [PATCH v2] irqchip/bcm2835: Quiesce IRQs left enabled by bootloader Message-ID: <20200212123651.apio6kno2cqhcskb@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2020 at 08:47:05PM -0800, Florian Fainelli wrote: > The commit message is a bit long and starts > going into details that I am not sure add anything I adhere to the school of thought which holds that commit messages shall provide complete context, including numbers to back up claims, user-visible impact, affected versions, genesis of the fix and so on. By that logic there's no such a thing as a too long commit message. Nevertheless please find a shortened version below, complete with the Fixes tag you requested as well as your R-b. On Wed, Feb 12, 2020 at 08:13:29AM +0000, Marc Zyngier wrote: > It otherwise looks good. You can either resend it with a fixed commit > message, > or provide me with a commit message that I can stick there while applying > it. The below also contains the patch itself, so can be applied directly with git am --scissors. Feel free to tweak as you see fit. Shout if I've missed anything. Thanks. -- >8 -- From: Lukas Wunner Subject: [PATCH] irqchip/bcm2835: Quiesce IRQs left enabled by bootloader Per the spec, the BCM2835's IRQs are all disabled when coming out of power-on reset. Its IRQ driver assumes that's still the case when the kernel boots and does not perform any initialization of the registers. However the Raspberry Pi Foundation's bootloader leaves the USB interrupt enabled when handing over control to the kernel. Quiesce IRQs and the FIQ if they were left enabled and log a message to let users know that they should update the bootloader once a fixed version is released. If the USB interrupt is not quiesced and the USB driver later on claims the FIQ (as it does on the Raspberry Pi Foundation's downstream kernel), interrupt latency for all other peripherals increases and occasional lockups occur. That's because both the FIQ and the normal USB interrupt fire simultaneously. On a multicore Raspberry Pi, if normal interrupts are routed to CPU 0 and the FIQ to CPU 1 (hardcoded in the Foundation's kernel), then a USB interrupt causes CPU 0 to spin in bcm2836_chained_handle_irq() until the FIQ on CPU 1 has cleared it. Other peripherals' interrupts are starved as long. I've seen CPU 0 blocked for up to 2.9 msec. eMMC throughput on a Compute Module 3 irregularly dips to 23.0 MB/s without this commit but remains relatively constant at 23.5 MB/s with this commit. The lockups occur when CPU 0 receives a USB interrupt while holding a lock which CPU 1 is trying to acquire while the FIQ is temporarily disabled on CPU 1. At best users get RCU CPU stall warnings, but most of the time the system just freezes. Fixes: 89214f009c1d ("ARM: bcm2835: add interrupt controller driver") Signed-off-by: Lukas Wunner Reviewed-by: Florian Fainelli Cc: stable@vger.kernel.org # v3.7+ Cc: Serge Schneider Cc: Kristina Brooks --- drivers/irqchip/irq-bcm2835.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c index 418245d..eca9ac7 100644 --- a/drivers/irqchip/irq-bcm2835.c +++ b/drivers/irqchip/irq-bcm2835.c @@ -135,6 +135,7 @@ static int __init armctrl_of_init(struct device_node *node, { void __iomem *base; int irq, b, i; + u32 reg; base = of_iomap(node, 0); if (!base) @@ -157,6 +158,19 @@ static int __init armctrl_of_init(struct device_node *node, handle_level_irq); irq_set_probe(irq); } + + reg = readl_relaxed(intc.enable[b]); + if (reg) { + writel_relaxed(reg, intc.disable[b]); + pr_err(FW_BUG "Bootloader left irq enabled: " + "bank %d irq %*pbl\n", b, IRQS_PER_BANK, ®); + } + } + + reg = readl_relaxed(base + REG_FIQ_CONTROL); + if (reg & REG_FIQ_ENABLE) { + writel_relaxed(0, base + REG_FIQ_CONTROL); + pr_err(FW_BUG "Bootloader left fiq enabled\n"); } if (is_2836) { -- 2.24.0