Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1492409pxb; Fri, 22 Oct 2021 01:54:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRkgH3WX0HhCPmmevcu4E94JQZNM4YcvhbT0hJ9tmyjZRfIMNOiuvz0R5878uFo6bbL+lx X-Received: by 2002:a17:90b:3e8d:: with SMTP id rj13mr13121572pjb.183.1634892899653; Fri, 22 Oct 2021 01:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634892899; cv=none; d=google.com; s=arc-20160816; b=NrcnMZ2t8bjI5//EgKe+OiEewb+d7DdigHUrvC7Rl6m/n4tJzfIcqbCo0BxJonnG59 86+RDyzEW4hwdCjypi6727zCX+mQ/L6igdmMAbBa67m/QyOrC0IKv3gIWu6UzH7/YSb0 tWwU3GUt+SOqy4tGHdY+wq6ONlUsDRIC0mYTKEjGyl1muJQHBhnOSWHO9E/pzDoRIZFE 8jvTATmk2A8CMnjOe+HhY7gUtytvU8AVmeMtgJ1Bc/5zcTD7PRhKlwlMGq6HTrHzmFFe TbPiNd1bmerwsF5wXvMF4r55TjBBC1g68cbJg3tfbouQzfFN1HzqCUXLUgnwS/6l+FN3 Xeeg== 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=IpW1ul+U4TSNh8kvN3LHGU3+14EGm2OYmn31ilFaXek=; b=Wu22KRS55H3X+I2q/OIHkdBPolEVpLvU8MGlBmzpTTFY5TlP86L7ybldhliZlJFrgJ jD6wM+vte2x9Z48eeJl6aKExRbbyZa1CZwtAHR1x3ydLf/XzbFzZk7uqSkpxukxwJVhl wImfhrkIMfIsyPkUTKJrj3qKjEftW+A+6Y8Ujxio4J8iCwPOhmzjlfOmSiY1Io+9W/15 bR0hIpgb0aItweDyHfWtM+9dLeJBDhaKaabKG7U8gmTbHNkXkoud6aNOHVMmnyjmHHs7 c8sJF221dUT4GphzfcKwpihfhU0QzoaxzO+JlceoqPL9U46NPWoe7rHJecYbSFwqlHzF xNiA== 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 j36si7177004pgi.342.2021.10.22.01.54.46; Fri, 22 Oct 2021 01:54:59 -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 S231991AbhJVIy3 (ORCPT + 99 others); Fri, 22 Oct 2021 04:54:29 -0400 Received: from foss.arm.com ([217.140.110.172]:51532 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbhJVIy3 (ORCPT ); Fri, 22 Oct 2021 04:54:29 -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 722E0ED1; Fri, 22 Oct 2021 01:52:11 -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 1FADC3F70D; Fri, 22 Oct 2021 01:52:08 -0700 (PDT) Date: Fri, 22 Oct 2021 09:52:02 +0100 From: Mark Rutland To: Guo Ren Cc: Linux Kernel Mailing List , Albert Ou , Catalin Marinas , Vincent Chen , Greentime Hu , Jonas Bonn , kernelfans@gmail.com, Linux ARM , Russell King , Marc Zyngier , Nick Hu , Palmer Dabbelt , Paul McKenney , Paul Walmsley , Peter Zijlstra , Stafford Horne , Stefan Kristiansson , Thomas Gleixner , Linus Torvalds , Thomas Bogendoerfer , vgupta@kernel.org, Will Deacon 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:33:53AM +0800, Guo Ren wrote: > On Fri, Oct 22, 2021 at 2:03 AM 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 Ah, I'd typo'd 'common' there; I'll go fix that... > > 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. > Shall we remove old_regs save/restore in handle_domain_irq? It's duplicated. We do, in patch 15 when handle_domain_irq() is removed entirely. :) Removing it immediately in this patch would require more ifdeffery and/or another copy of handle_domain_irq(), and since the duplication doesn't cause a functional problem, I think it's better to live with the temporary duplication for the next few patches than to try to optimize the intermediate steps at the cost of legibility. Thanks, Mark. > > 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); > > + set_irq_regs(old_regs); > > + irq_exit(); > > +} > > #endif > > -- > > 2.11.0 > > > > > -- > Best Regards > Guo Ren > > ML: https://lore.kernel.org/linux-csky/