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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2486BC433FE for ; Wed, 11 May 2022 00:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232156AbiEKAMY (ORCPT ); Tue, 10 May 2022 20:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232070AbiEKAL4 (ORCPT ); Tue, 10 May 2022 20:11:56 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60339DA8; Tue, 10 May 2022 17:11:55 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652227913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LNuHk31MU8NfbUkWhTQWEmIsDRSnnMCHcYTmT8fO/lY=; b=EuVQqWjL/KUqB/CW2WZnKUENdoV3TuMemWSLrLHG/zjCnV2kJitekfdllmCrXeRBHAgkJl N9VGxaJCPGSLpEX+u6uP4cm9q+FXGP6kAIXyis97mVl9efUDKvqZudiBjyKHmvGVyVc331 43Fg5Q+fRfE0e3IaLyJPZ0p5wt2T9HRbzYztEW/EhAMaYQDSHLlFfjW7EOykBDmmYsJ8DQ dJXQBxEOYamLScb9r7J3jtrV3iKhhBZGCJlbcWi+8Nknu81VMZ4fSewlMvNj0p0Nuo45ky gF9fFsq4IivHfX7IPAFsf8L3pw769T3RIzGmQ1C3rUDE9HHCwuhzA0bbqbp6rA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652227913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LNuHk31MU8NfbUkWhTQWEmIsDRSnnMCHcYTmT8fO/lY=; b=5etwy+oQ4vqvPZjT8W/1Hehtrb4Q311ZjDMAfdogHZdAvif7QwpoU5ASIW8mLslfRgL21+ aAAQpQODQg29I9DA== To: Mark Rutland , Lukas Wunner Cc: maz@kernel.org, Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Octavian Purdila , 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, palmer@dabbelt.com, paul.walmsley@sifive.com, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tsbogend@alpha.franken.de, vgupta@kernel.org, vladimir.murzin@arm.com, will@kernel.org Subject: Re: [PATCH v2 17/17] irq: remove handle_domain_{irq,nmi}() In-Reply-To: References: <20211026092504.27071-1-mark.rutland@arm.com> <20211026092504.27071-18-mark.rutland@arm.com> <20220506203242.GA1855@wunner.de> <20220510121320.GA3020@wunner.de> Date: Wed, 11 May 2022 02:11:52 +0200 Message-ID: <874k1xorlj.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On Tue, May 10 2022 at 15:15, Mark Rutland wrote: > On Tue, May 10, 2022 at 02:13:20PM +0200, Lukas Wunner wrote: >> Actually, since you're mentioning the in_nmi() check, I suspect >> there's another problem here: >> >> generic_handle_domain_nmi() warns if !in_nmi(), then calls down >> to handle_irq_desc() which warns if !in_hardirq(). Doesn't this >> cause a false-positive !in_hardirq() warning for a NMI on GIC/GICv3? > > I agree that doesn't look right. > >> The only driver calling request_nmi() or request_percpu_nmi() is >> drivers/perf/arm_pmu.c. So that's the only one affected. >> You may want to test if that driver indeed exhibits such a >> false-positive warning since c16816acd086. > > In testing with v5.18-rc5, I can't see that going wrong. > > I also hacked the following in: > > -------->8-------- > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index 939d21cd55c38..3c85608a8779f 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -718,6 +718,7 @@ EXPORT_SYMBOL_GPL(generic_handle_domain_irq); > int generic_handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq) > { > WARN_ON_ONCE(!in_nmi()); > + WARN_ON_ONCE(!in_hardirq()); > return handle_irq_desc(irq_resolve_mapping(domain, hwirq)); which is pointless because NMI entry code has to invoke [__]nmi_enter() before invoking this function. [__]nmi_enter() does: __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); So it's more than bloody obvious why there is no warning triggered for a regular hardware induced NMI invocation. For a software invocation from the wrong context it does not matter how many redundant WARN_ONs you add. The existing ones are covering it nicely already. Thanks, tglx 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 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 B9BDCC433EF for ; Wed, 11 May 2022 00:13:12 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hf55DhL6fOwodYKQdjK1EZhipNSCQc7h+Nhof4LkT/M=; b=qtBJf7Xdt2wiiy ypNMVIt/W3shR7xCUQmUQzF4jZ00bDCeFXP7frf3iBfx5pQY60R8csvjqV1+bGXV2qHNAM3BhUzzk EtDkIEZsJ3mOvY4XioDNpQ5ZbFQcWIyObBLb3BYgkzZsJD52eLjlEWgdSLzq/34x5n4E84L2DYQ38 ltLHMS6/ObM/SZsPz6TBS/xTXPWwJbUp+CxRk8fky1IeYL9W5+O5eluxZXjF4NSIMTcpC44nuZhv3 CXmuN38G5zFkxZJcZ7/pwjBXCN/H6xJS9daRuiYTshkTAAD4YRLTR2K8uDcUMiQcEgtbkXoa7m0LV EjW8k0dguT0OcD9sQAUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1noZxR-004TnZ-KL; Wed, 11 May 2022 00:12:01 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1noZxP-004TnE-2v for linux-arm-kernel@lists.infradead.org; Wed, 11 May 2022 00:12:00 +0000 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652227913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LNuHk31MU8NfbUkWhTQWEmIsDRSnnMCHcYTmT8fO/lY=; b=EuVQqWjL/KUqB/CW2WZnKUENdoV3TuMemWSLrLHG/zjCnV2kJitekfdllmCrXeRBHAgkJl N9VGxaJCPGSLpEX+u6uP4cm9q+FXGP6kAIXyis97mVl9efUDKvqZudiBjyKHmvGVyVc331 43Fg5Q+fRfE0e3IaLyJPZ0p5wt2T9HRbzYztEW/EhAMaYQDSHLlFfjW7EOykBDmmYsJ8DQ dJXQBxEOYamLScb9r7J3jtrV3iKhhBZGCJlbcWi+8Nknu81VMZ4fSewlMvNj0p0Nuo45ky gF9fFsq4IivHfX7IPAFsf8L3pw769T3RIzGmQ1C3rUDE9HHCwuhzA0bbqbp6rA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652227913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LNuHk31MU8NfbUkWhTQWEmIsDRSnnMCHcYTmT8fO/lY=; b=5etwy+oQ4vqvPZjT8W/1Hehtrb4Q311ZjDMAfdogHZdAvif7QwpoU5ASIW8mLslfRgL21+ aAAQpQODQg29I9DA== To: Mark Rutland , Lukas Wunner Cc: maz@kernel.org, Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org, Octavian Purdila , 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, palmer@dabbelt.com, paul.walmsley@sifive.com, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tsbogend@alpha.franken.de, vgupta@kernel.org, vladimir.murzin@arm.com, will@kernel.org Subject: Re: [PATCH v2 17/17] irq: remove handle_domain_{irq,nmi}() In-Reply-To: References: <20211026092504.27071-1-mark.rutland@arm.com> <20211026092504.27071-18-mark.rutland@arm.com> <20220506203242.GA1855@wunner.de> <20220510121320.GA3020@wunner.de> Date: Wed, 11 May 2022 02:11:52 +0200 Message-ID: <874k1xorlj.ffs@tglx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220510_171159_310494_8A82953D X-CRM114-Status: GOOD ( 16.32 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 10 2022 at 15:15, Mark Rutland wrote: > On Tue, May 10, 2022 at 02:13:20PM +0200, Lukas Wunner wrote: >> Actually, since you're mentioning the in_nmi() check, I suspect >> there's another problem here: >> >> generic_handle_domain_nmi() warns if !in_nmi(), then calls down >> to handle_irq_desc() which warns if !in_hardirq(). Doesn't this >> cause a false-positive !in_hardirq() warning for a NMI on GIC/GICv3? > > I agree that doesn't look right. > >> The only driver calling request_nmi() or request_percpu_nmi() is >> drivers/perf/arm_pmu.c. So that's the only one affected. >> You may want to test if that driver indeed exhibits such a >> false-positive warning since c16816acd086. > > In testing with v5.18-rc5, I can't see that going wrong. > > I also hacked the following in: > > -------->8-------- > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index 939d21cd55c38..3c85608a8779f 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -718,6 +718,7 @@ EXPORT_SYMBOL_GPL(generic_handle_domain_irq); > int generic_handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq) > { > WARN_ON_ONCE(!in_nmi()); > + WARN_ON_ONCE(!in_hardirq()); > return handle_irq_desc(irq_resolve_mapping(domain, hwirq)); which is pointless because NMI entry code has to invoke [__]nmi_enter() before invoking this function. [__]nmi_enter() does: __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); So it's more than bloody obvious why there is no warning triggered for a regular hardware induced NMI invocation. For a software invocation from the wrong context it does not matter how many redundant WARN_ONs you add. The existing ones are covering it nicely already. Thanks, tglx _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel