Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1498761pxb; Fri, 22 Oct 2021 02:04:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyConWkYhZLH2VvqPs5VQ4TLN1uIrqMR+6X4ZsItdz3ywaEVjVF0Oz+qtL93a4FtD8uEDIH X-Received: by 2002:a63:6e4d:: with SMTP id j74mr4212083pgc.257.1634893442348; Fri, 22 Oct 2021 02:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634893442; cv=none; d=google.com; s=arc-20160816; b=mthpQmBpuDlN1H3u2mRgovypk3KaHSzALA5TXWqFfBMzmQjfIcX0jgEOO7nfJ4dQJG +LMG4NcbMbglafA2/VW9ixNpfjghL6XJ+thWzgMTf9JdacUl2RHcpLTG37KE/0cYi08C zplC5yHDGctjPxU+iookRWucMcCCyJpWSBCWzR1lg8N9yKy5fX/bq2qx3VeZBxGVMRhk UpLLAcfi3idIxeUwvzzRkPNH83SNCBmmifhPUfQ9/tm8s8QHWwGJqS61W63COIjjaDnr lL20nndJ2M2p28aAdW5WGMbEuAyR99MJBQbQrOUSP1w9BSRD6h80BZn0mDe5ObCn1EeO fIUg== 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=RHe38kFeF/HAWQpGjiUkxqo1t9xB03ioWTUZH+gRh4o=; b=kmjl6QygFoS9cBjz0KDZQP2Pyj+vgJfykofhYLkYTe8UTSP9752DGo/d6Hg7X3cPKm 8KPpYVj3WzCr/wv9OioReQe9QnhnmxzDxX8tegBp3t+oIJ5boNQtyLfoTWl6EZfKX6wh GG4eF56RI6O15BGou36FXLIc3Idb5k4Max+IWc+gAvFSqe7o9rglnF81mxpF56fFY0qy axWWb1ahnIUrbJ4ucgW4at0zI2qrUGj5NMogJLA0k/zrDT89gcpTFfzSag9mxkJrpas8 xCy0WytuHx1lJZJIx1DUEP8hk9+nBEMjr9Ouj1F74NxVrPC8j9YXOQW+C9G0YDZcCLbi u+ow== 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 b8si18589082pjd.87.2021.10.22.02.03.49; Fri, 22 Oct 2021 02:04:02 -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 S232249AbhJVJEw (ORCPT + 99 others); Fri, 22 Oct 2021 05:04:52 -0400 Received: from foss.arm.com ([217.140.110.172]:51704 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbhJVJEv (ORCPT ); Fri, 22 Oct 2021 05:04:51 -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 2DC56ED1; Fri, 22 Oct 2021 02:02:34 -0700 (PDT) Received: from FVFF77S0Q05N (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D26BC3F70D; Fri, 22 Oct 2021 02:02:30 -0700 (PDT) Date: Fri, 22 Oct 2021 10:02:28 +0100 From: Mark Rutland To: Pingfan Liu Cc: 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, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, maz@kernel.org, nickhu@andestech.com, palmer@dabbelt.com, paulmck@kernel.org, paul.walmsley@sifive.com, peterz@infradead.org, shorne@gmail.com, stefan.kristiansson@saunalahti.fi, tglx@linutronix.de, torvalds@linux-foundation.org, tsbogend@alpha.franken.de, vgupta@kernel.org, will@kernel.org Subject: Re: [PATCH 05/15] irq: add generic_handle_arch_irq() Message-ID: References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-6-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 10:10:26AM +0800, Pingfan Liu wrote: > On Thu, Oct 21, 2021 at 07:02:26PM +0100, Mark Rutland wrote: > > Several architectures select GENERIC_IRQ_MULTI_HANDLER and branch to > > handle_arch_irq() without performing any entry accounting. > > > > Add a generic wrapper to handle the commoon irqentry work when invoking > > handle_arch_irq(). Where an architecture needs to perform some entry > > accounting itself, it will need to invoke handle_arch_irq() itself. > > > > In subsequent patches it will become the responsibilty of the entry code > > to set the irq regs when entering an IRQ (rather than deferring this to > > an irqchip handler), so generic_handle_arch_irq() is made to set the irq > > regs now. This can be redundant in some cases, but is never harmful as > > saving/restoring the old regs nests safely. > > > > Signed-off-by: Mark Rutland > > Cc: Marc Zyngier > > Cc: Thomas Gleixner > > --- > > kernel/irq/handle.c | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c > > index 221d80c31e94..27182003b879 100644 > > --- a/kernel/irq/handle.c > > +++ b/kernel/irq/handle.c > > @@ -14,6 +14,8 @@ > > #include > > #include > > > > +#include > > + > > #include > > > > #include "internals.h" > > @@ -226,4 +228,20 @@ int __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) > > handle_arch_irq = handle_irq; > > return 0; > > } > > + > > +/** > > + * generic_handle_arch_irq - root irq handler for architectures which do no > > + * entry accounting themselves > > + * @regs: Register file coming from the low-level handling code > > + */ > > +asmlinkage void noinstr generic_handle_arch_irq(struct pt_regs *regs) > > +{ > > + struct pt_regs *old_regs; > > + > > + irq_enter(); > > + old_regs = set_irq_regs(regs); > > + handle_arch_irq(regs); > > After all involved arches call generic_handle_arch_irq(), can > handle_arch_irq be encapsulated by declaring as static? > > Two places need to be fixed for this purpose: > -1. absorb the logic about handle_arch_irq in arm64/kernel/irq.c > -2. In arm, setup_arch(), > #ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER > handle_arch_irq = mdesc->handle_irq; > #endif That arm bit would need to be set_handle_irq(mdesc->handle_irq); anywhere it uses handle_arch_irq it's depending on the CONFIG_GENERIC_IRQ_MULTI_HANDLER definition. While I agree it would seem nice to encapsulate this, in future we want architectures to move to the more correct entry sequencing described in the cover letter, and when that happens they should invoke handle_arch_irq() directly, so I think this is best to leave as-is. We have custom logic on arm64 because we want to handle IRQ and FIQ consistently, and there wasn't a neat way to bodge that into the generic code, but that issue doesn't apply to the other users of CONFIG_GENERIC_IRQ_MULTI_HANDLER. Thanks, Mark.