From patchwork Tue May 10 07:56:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 12844651 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 D1D1BC433F5 for ; Tue, 10 May 2022 08:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Date:From: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+JFSlj0yxey3/1qDT9VRQAcpl243VmBJAjBEeaQE6hw=; b=l3JEzTxqOPswL8 Xd8IgNpYtNgNarlJ2FrKuYv3Uh9RX3zK24wzqpr/7HzRhZU/V33rdpS2TrR+VyybcfH0zUplkr4jg Y+E0L86VxgHGWtnpafovz4yMwyb9WGJwsQjNu6LsMXug/rEdLb7Yi4XQU+sfVX0Vb8JS1r0sQynrL 5Z9jMk3DeqP4b/rAXRNWjXyY0i7R+8L6kVsj3rMkZ+lg8rMF+oOSZRI157gox1QKAnK57sfwIcXNf ES9m9y0al2xU70PGSnXMsxxqP5d0PayGXoQy5MnL67ElxMcuZcsZy/P+x8aFKY9/IR3ahAphQFwpw qqXK3R/A3jq0TvyW3PxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noKow-000UqG-I5; Tue, 10 May 2022 08:02:14 +0000 Received: from bmailout1.hostsharing.net ([83.223.95.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noKot-000Unx-RO for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2022 08:02:13 +0000 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 6CA86300069FE; Tue, 10 May 2022 09:56:19 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 608802E6C12; Tue, 10 May 2022 09:56:19 +0200 (CEST) Message-Id: From: Lukas Wunner Date: Tue, 10 May 2022 09:56:05 +0200 Subject: [PATCH] genirq: Deduplicate WARN_ON_ONCE() in generic_handle_domain_irq() To: Thomas Gleixner , Marc Zyngier , Mark Rutland Cc: Jakub Kicinski , Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Octavian Purdila , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220510_010212_072286_92967658 X-CRM114-Status: GOOD ( 13.09 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit 0953fb263714 ("irq: remove handle_domain_{irq,nmi}()"), generic_handle_domain_irq() warns if called outside hardirq context, even though the function calls down to handle_irq_desc(), which warns about the same. Moreover the newly added warning is false positive if the interrupt originates from any other irqchip than x86 APIC or arm GIC/GICv3. Those are the only ones for which handle_enforce_irqctx() returns true. Per commit c16816acd086 ("genirq: Add protection against unsafe usage of generic_handle_irq()"): "In general calling generic_handle_irq() with interrupts disabled from non interrupt context is harmless. [But for] interrupt controllers like the x86 trainwrecks this is outright dangerous as it might corrupt state if an interrupt affinity change is pending." An example for irqchips where the warning is false positive are USB-attached GPIO controllers such as drivers/gpio/gpio-dln2.c: USB gadgets are incapable of directly signaling an interrupt because they cannot initiate a bus transaction by themselves. All communication on the bus is initiated by the host controller, which polls a gadget's Interrupt Endpoint in regular intervals. If an interrupt is pending, that information is passed up the stack in softirq context, from which a hardirq is synthesized via generic_handle_domain_irq(). Deduplicate the warning to eliminate false positives and speed up IRQ handling. Fixes: 0953fb263714 ("irq: remove handle_domain_{irq,nmi}()") Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org # v5.16+ Cc: Mark Rutland --- kernel/irq/irqdesc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 939d21c..da3e495 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -699,7 +699,6 @@ int generic_handle_irq_safe(unsigned int irq) */ int generic_handle_domain_irq(struct irq_domain *domain, unsigned int hwirq) { - WARN_ON_ONCE(!in_hardirq()); return handle_irq_desc(irq_resolve_mapping(domain, hwirq)); } EXPORT_SYMBOL_GPL(generic_handle_domain_irq);