Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4699359pxb; Tue, 28 Sep 2021 01:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLdXYVuhizrrpWMLa6tjKe2nv8SrAXlAnBo3H8ekE5w85VSd1DS1BU3Tp8j8FLiXc0edJU X-Received: by 2002:a17:902:ed8a:b0:13b:7a09:5215 with SMTP id e10-20020a170902ed8a00b0013b7a095215mr4158190plj.56.1632819365632; Tue, 28 Sep 2021 01:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632819365; cv=none; d=google.com; s=arc-20160816; b=dQJSph4AhECGBT53QPUWmaK1omSO/oQyv8zMfq7jHVRxCdSYoo2eAD070aOJRHKGtC DigR5kPScgyW1Ghtxp9aUi1wzciMU+QMi9hQnvtj7sUf2rIvYadNo2FpEB68wVA7DETH MJnv/IEyYhXoOUcZzUnpMAb6pIWm5b8gPA84Zx5P57aO99Xhq5Yb4v1WFZWKAGOT07WS eWBuQxFF29FUL1g32idojDF4ZzSJG4vv+9adVU2uqh3rQS18zvpsBVP05JQXDShg2XdN zXBNzfQoHZ8GhltKBOHK43Yfem6Kz/Y/KYdg3B4yO/NtPnJ8gOqfUjXwrYyDe2rRa/lh 40qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=0VG3QD05ytQCZ7utkZ28ybitwVmQibBdRBcf3oQl1mw=; b=uLExKSvAwTg23u9uXCcFn25jXfAFIGcqo8opvYWwSrixMPepz2iusfglq+RfmxMKEo 0+Md3nkv+qTokOPjJgUan2pivhxZe2umfts7El2y3Y3yx6o5FdzydLA65OO6dzFHgNEe IPTX2uGdkjTby9f+zUb7jCvcxWbNMWJIJgwmuNtiDMEa3caTJmk9+CAMX9UVO9qIlb2g fy086A7ju3Z25YD/c3WRJ8U9arpehoJWFR/PVSxRzT2t9qrImiFED7sc26ghjBOuyYKh vLDqqFSmUwnzxwinjZofmoC8V9TaaSNVaxm0soBbSYm8t80T9ZeLt+8GqlRZPHLoNbpw 8ZqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d131si16861183pgc.250.2021.09.28.01.55.53; Tue, 28 Sep 2021 01:56:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239732AbhI1I4q (ORCPT + 99 others); Tue, 28 Sep 2021 04:56:46 -0400 Received: from foss.arm.com ([217.140.110.172]:42868 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239712AbhI1I4p (ORCPT ); Tue, 28 Sep 2021 04:56:45 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D28C46D; Tue, 28 Sep 2021 01:55:05 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.23.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5487A3F7B4; Tue, 28 Sep 2021 01:55:03 -0700 (PDT) Date: Tue, 28 Sep 2021 09:55:00 +0100 From: Mark Rutland To: Pingfan Liu Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Catalin Marinas , Will Deacon , Marc Zyngier , Joey Gouly , Sami Tolvanen , Julien Thierry , Yuichi Ito , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCHv2 3/5] kernel/irq: make irq_{enter,exit}() in handle_domain_irq() arch optional Message-ID: <20210928085500.GC1924@C02TD0UTHF1T.local> References: <20210924132837.45994-1-kernelfans@gmail.com> <20210924132837.45994-4-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210924132837.45994-4-kernelfans@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 24, 2021 at 09:28:35PM +0800, Pingfan Liu wrote: > handle_domain_irq() contains two major parts: > -1. irq_enter()/irq_exit(), which serves as hooks for rcu and trace etc. > -2. irq mapping and dispatching > > After the introduction of irqentry_enter()/irqentry_exit() and arch > specific counterpart (e.g. arm64), roughly speaking, rcu_irq_enter() has > already been called. Hence here comes requirement to move > irq_enter/irq_exit out of handle_domain_irq(). And arches should handle > about irq_enter_rcu()/irq_exit_rcu() by themself. > > Since there is still arches, which does not adopt irqentry_enter(), let > irq_enter()/irq_exit() arch optional in handle_domain_irq(). The patch below looks good to me, but the commit message is a little hard to follow. How about: When an IRQ is taken, some accounting needs to be performed to enter and exit IRQ context around the IRQ handler. Historically arch code would leave this to the irqchip or core IRQ code, but these days we want this to happen in exception entry code, and architectures such as arm64 do this. Currently handle_domain_irq() performs this entry/exit accounting, and if used on an architecture where the entry code also does this, the entry/exit accounting will be performed twice per IRQ. This is problematic as core RCU code such as rcu_is_cpu_rrupt_from_idle() depends on this happening once per IRQ, and will not detect quescent periods correctly, leading to stall warnings. As irqchip drivers which use handle_domain_irq() need to work on architectures with or without their own entry/exit accounting, this patch makes handle_domain_irq() conditionally perform the entry accounting depending on a new HAVE_ARCH_IRQENTRY Kconfig symbol that architectures can select if they perform this entry accounting themselves. For architectures which do not select the symbol. there should be no functional change as a result of this patch. With that commit message: Reviewed-by: Mark Rutland Mark. > Signed-off-by: Pingfan Liu > Cc: Thomas Gleixner > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Cc: Marc Zyngier > Cc: Joey Gouly > Cc: Sami Tolvanen > Cc: Julien Thierry > Cc: Yuichi Ito > Cc: linux-arm-kernel@lists.infradead.org > To: linux-kernel@vger.kernel.org > --- > kernel/irq/Kconfig | 3 +++ > kernel/irq/irqdesc.c | 4 ++++ > 2 files changed, 7 insertions(+) > > diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig > index fbc54c2a7f23..defa1db2d664 100644 > --- a/kernel/irq/Kconfig > +++ b/kernel/irq/Kconfig > @@ -100,6 +100,9 @@ config IRQ_MSI_IOMMU > config HANDLE_DOMAIN_IRQ > bool > > +config HAVE_ARCH_IRQENTRY > + bool > + > config IRQ_TIMINGS > bool > > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index 4e3c29bb603c..fd5dd9d278b5 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -693,7 +693,9 @@ int handle_domain_irq(struct irq_domain *domain, > struct irq_desc *desc; > int ret = 0; > > +#ifndef CONFIG_HAVE_ARCH_IRQENTRY > irq_enter(); > +#endif > > /* The irqdomain code provides boundary checks */ > desc = irq_resolve_mapping(domain, hwirq); > @@ -702,7 +704,9 @@ int handle_domain_irq(struct irq_domain *domain, > else > ret = -EINVAL; > > +#ifndef CONFIG_HAVE_ARCH_IRQENTRY > irq_exit(); > +#endif > set_irq_regs(old_regs); > return ret; > } > -- > 2.31.1 >