Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5721782iob; Tue, 10 May 2022 02:03:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8Bz4wtYSmjoq3eoJofn4gQGgHAylGXlhd4swfSyt6qdhlwSne7ae2M/NC/poL4qhMF7k7 X-Received: by 2002:a05:6602:2e8c:b0:64d:633a:4148 with SMTP id m12-20020a0566022e8c00b0064d633a4148mr8331457iow.12.1652173406207; Tue, 10 May 2022 02:03:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652173406; cv=none; d=google.com; s=arc-20160816; b=w3nnneppK0vAJPl5+xBaMGyShFfJex/MO+Nx+cT6Gsy1rF0ljM/2MY4WNVamP0GkVv CA8hdkHjoy06o2g9Q5FJ05LnNlZlJmRqvQ6jgGI4qG/jESNDZoG/qgUbmj6Ry8yNhVJa DyTnwY5y0X1z6c4P1g0iXBw1D4tGr1uJLW9geldUzCuI+QQJWIEtMDQSVTaS8g3u6pdR DKHxt6FzMBK3a5KOV1x82oEW+/OYBxNR0Ee0K9WFGrN+anunq6Aj3+EuCtSCHyuVPZug qJgTuTpQdAWZsmAATW5BMk/cvC+u+pw+QFtspEbpIeZp8zRQ8IMsupTGFpuj69jFFpxd TZWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:date:from:message-id; bh=CMY+yitIo3n74AdFyK6wt+KQARphqHVc7DNptwOOmfs=; b=FYtU+opygNa6PldrzZNG8rpABhZlnP/ByyNG9nlMItpNxD3uISSMiHk3/zFi7BP5Fo hmSkA86gRC3qy8uxdq+9CkhQaAconbHGrjvDLF/bcEh9bsh/OuffhhK1JnURXviTxmCZ MFSv9x3N9PtgLj+DxJ0gJXCyqwZ/lU/hg7uJeHZQtSkEaAM0ftLFTE4Cq54KKzFJHqZP aN+hIbfB1HyWjJLhekEJFlhwq50Wc3LdNdJgjwKm1JMkEzfwJzhChXqX1F2JnjOts5PV iQ1qAxn0G4n8bEd5Z9YzAkAGMQ9hOKgL8bqOy9WOdA5dsKcwkAB+UmgnYAl+u8QfK2Mu tgHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a056638150700b0032bdf604084si11707474jat.62.2022.05.10.02.03.13; Tue, 10 May 2022 02:03:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237540AbiEJIA0 (ORCPT + 99 others); Tue, 10 May 2022 04:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231442AbiEJIAU (ORCPT ); Tue, 10 May 2022 04:00:20 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6ED91D8109; Tue, 10 May 2022 00:56:21 -0700 (PDT) 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-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 2.35.2