Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3206568pxb; Sat, 23 Oct 2021 19:15:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqIRpCGsVsb1t86xgJn6cdpCs+Xdk3cHZgvtZbeALuXtUuFn26pdWXpUIJwsAkrnBum2OH X-Received: by 2002:a05:6402:4308:: with SMTP id m8mr13746133edc.188.1635041715063; Sat, 23 Oct 2021 19:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635041715; cv=none; d=google.com; s=arc-20160816; b=blmktzIloRyEDBG8iq4TYgDOiyN+1awgkGy/gKcu/0lAhBHFF5EJtUpV9Hu+9X6VOo c5UQOVPI6OxPMM5KLEi42wZxHiG4+Az4EIUjjRakx3/F5vjUpsDHN0dqYjQ6HchScY5G kWX3RXWJdLw5Vw8eHROS43JuX754MXm6WhKAISvsqomqmkAkfC3fdl+gf0Kr3SeUP2/D ctncmLGlORiOUIIZnEs9H4WAdEvPOeGVRqH1zCxL4/aC3/SM/eRhKP3XhNirsaBZzM5d fTQWOXmE6zE3b8W+DHcHsgG5FJN5Jy9gUuLxOD5cN59KkSHorXAtIMp45uM1GRk4sIfo 3kKQ== 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=D9TCYeMZZeb7Id56FsdS/CVB4JhZDHxnssZomp4qBlI=; b=nsUHcZOTKvw0ODQOiP3crd0Yd2pj6iUel+g95AspPpC4qY2Y8A8ezH+5pci3DYyrEy TnVb6opETZdU1J7Irp2vOs1BY3T1AkjZpuTJywSMCrdklSTth8PHZHHCdD+6bzdEluoF 8rcEGCRfgorABSIQHPN4yt6Zd7CUCNuNm0WoKbEiUBCaRHPqnOeei8fcekr2wHtvn15r WbMkKJQDXDnXTDLIVG53N19BZX7fXwHSIxyQ0ewGkpltceAGaGldzrmHpMsC2Pz1soR4 EquA6wrQJ9TjwBVVmv4f8B31rQ12lQgXSCV+AijQODT1XgoimeeaedEBGQe5p3Xrgvq9 24YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="YV7/MLnQ"; 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 d22si7801025ede.610.2021.10.23.19.14.26; Sat, 23 Oct 2021 19:15:15 -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="YV7/MLnQ"; 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 S231376AbhJXBzx (ORCPT + 99 others); Sat, 23 Oct 2021 21:55:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:33848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbhJXBzw (ORCPT ); Sat, 23 Oct 2021 21:55:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85A1860FC4 for ; Sun, 24 Oct 2021 01:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635040412; bh=dgtGbUaKyJhkeN8FVxfsoKQ31HtE58GU7i+rzNa2uwA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YV7/MLnQmjz0thsDbFFObufT2E2VpjBqjq7wPMpBcQjA1HrRjfyJdXL2kMPkmzMt2 YQbzRtjQd3TMZpCZwhyDNQjmK1nNgA3XxZyv8lEIgSeSucEh7i5SbPscoj1x7eemAt RFf51MhiFv3ImLRkRGVdyfjRMA76q+DnlInDUdUaHwrZuqOnBh6sqr7F4VkuEW1NFC ALKM6byos2V1IBn/zA+A9PGptqJddiuFBWranOWCpFP3xI2oQPeLBX48gNZRYj6HIW FUwQfXT+2+puAOnnBLJlczxu3PAqp+eqv6OE3DzV6JSFGXVw7eiY0ZSNYzSift7l5c DgOG5Xv+vKvpA== Received: by mail-ua1-f51.google.com with SMTP id o26so1220866uab.5 for ; Sat, 23 Oct 2021 18:53:32 -0700 (PDT) X-Gm-Message-State: AOAM530g7zAnwI20PHZzM1i3RnWe5il9My3YXuP+c0mlhXL5+d7TBLYM L4g6Cl7MVJfovwxWWiOsc1d3c99h9KgARUWfJSo= X-Received: by 2002:a67:ca1c:: with SMTP id z28mr9245548vsk.11.1635040411387; Sat, 23 Oct 2021 18:53:31 -0700 (PDT) MIME-Version: 1.0 References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-6-mark.rutland@arm.com> In-Reply-To: From: Guo Ren Date: Sun, 24 Oct 2021 09:53:20 +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 4:52 PM Mark Rutland wrote: > > 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. :) I miss that patch. Yes, in generic_handle_domain_nmi. > > 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. Thx for explaining. Reviewed-by: Guo Ren > > 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/ -- Best Regards Guo Ren ML: https://lore.kernel.org/linux-csky/