Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1255168pxb; Thu, 21 Oct 2021 19:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXum9QAMa6x9pVW8p7947kOraLCtl/7vgRCNus/aU4MHWhIz0ePjHD9rzxCvLZCgpurPbG X-Received: by 2002:a50:99c6:: with SMTP id n6mr12723232edb.171.1634870180282; Thu, 21 Oct 2021 19:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634870180; cv=none; d=google.com; s=arc-20160816; b=R4q7VPi9kHylqtmVHJ3bqAMCuAmuGjWO/eHtio0/7n86THhuNdQPnr3dVL0xXa4qeL ZK2bixTmCIrLbBjkGQF1ebDxNUyX+o3VwD9RXekzBA4nSkEZiAYof1St3ImFfueTxWyR qCpOWGNz+H96tA8s7ahi4/k3ejiPaU7g5ILiif4yqtNSf19uJtvCDmzkw8M3aPK98n7Z oBCVm2gt1p5f42SXIITvd4ZNMcRjyGXigtFqaqtOTiy5oj1u9axCTunojN4vi2AIO7it J7uDBbQExGJ/dnVfinpQ2YH3q5IC8eObikBG0Cc2nnmG/pil7Bg07E5zxY+rPWpX1UD1 +9Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=u+YWVn/SBLNMwgPSrpMJVO8Oj+fo6O3Wsy+xYXsnLTg=; b=QbWbRbLsaIJ4hQrKe3wjU03gQQfggbYjjra7C9EmLOIcWJyVZy+1x4gb6T3dTgkE1J pidH8MRyB026vQIjKy7eOnxPKKrWMMS1lrt3tDh8dU0Eolsa5dt9UgMNMfL1Oybtrps9 x4YgGUxvPwFqA2XTjGDvD6gIy3iXrU35il+dSc5oSqwSqpVc+dfSoy08KO2oSplYLcwr mRtPOaaszwsNgvg0flxmrIV6GDhUeRcQrZqlGvDkvNivPnQig2WkkkfxA/Opd99PsCr2 FenFBj2w00cuz2sE4NltisaffyZXoy+93U6hO2knv4RSstOcOEVrzz6FD7ynMkqP/V3m MSBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TcBj99Oy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si1588447edv.229.2021.10.21.19.35.56; Thu, 21 Oct 2021 19:36:20 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TcBj99Oy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231687AbhJVCgX (ORCPT + 99 others); Thu, 21 Oct 2021 22:36:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:58492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231518AbhJVCgW (ORCPT ); Thu, 21 Oct 2021 22:36:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 71A0161409 for ; Fri, 22 Oct 2021 02:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634870045; bh=S30f/+4VZLDl1PWHOF5O1gKoF4vRAQfxCHgNTi38Jjc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=TcBj99OyD6zWF3UwXNFRErx0LcXWJ57hWLCAODhAwPN6kY0KPhyGt21FAMPg1GZl3 pzj8LGVJ1PNHo5dBfsUhGMqkl+YPLS8DPL5+cCJaaJilShS3WuLiANd0JHZOdlZdtO f8N/IQVGM5SZ6+h8P+UHxSvVyLWG5yWeSWMF+ypSav4rLK5oCWl6LtTMMUSki0fBxy lOq9fUns4i7EN9kbED2E/rNXGQx+mew4oOVbyx2Z9/Nno5cj94g3uqYvBbaEBRgiV3 Q9QwLKPoPZjsKPJtf14vst6AfEmWH88h58srGo1tE9yLgOTea6tAwJWjcVto6rOGBJ 4ZwU1WzPgCITA== Received: by mail-ua1-f53.google.com with SMTP id u5so4912860uao.13 for ; Thu, 21 Oct 2021 19:34:05 -0700 (PDT) X-Gm-Message-State: AOAM530QblCTitzkz7gpBmajVpRvfDGMVfxAXlTBnVkgffBaOfvWXJ5q 2sPm85hb3AKVuoKHe5evaFtNE/gHO9EKA+czAG8= X-Received: by 2002:a67:ca1c:: with SMTP id z28mr11938388vsk.11.1634870044525; Thu, 21 Oct 2021 19:34:04 -0700 (PDT) MIME-Version: 1.0 References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-6-mark.rutland@arm.com> In-Reply-To: <20211021180236.37428-6-mark.rutland@arm.com> From: Guo Ren Date: Fri, 22 Oct 2021 10:33:53 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 05/15] irq: add generic_handle_arch_irq() To: Mark Rutland 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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. > > 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/