Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1545445pxb; Fri, 22 Oct 2021 03:07:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0vDvVI5LqvHK03AGNnhD41ZSjzal55trxP4z+CBGUGFsDFIZzfnrEVsf2mchJwfdaUc7t X-Received: by 2002:a17:906:28cd:: with SMTP id p13mr5107486ejd.568.1634897268082; Fri, 22 Oct 2021 03:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634897268; cv=none; d=google.com; s=arc-20160816; b=WwpBc1tqJ9wtLqkpHJtD6dy833wGVUPte6WmRrWJnkyw46Rn4Ngd+BBbrXBb9IAMr9 HEt2UOMd+8mX3JQZfwdUcP9OK5SbpezMeM27lbtvOphcrtb1uUnoYd+CUpA+wxyoTEBI Z9BCvwiDq4R2fHiWTp+pGgrSWHeAbWzaxumbmi6YzR+e11wsiilwaoqdAm/Igc0iHaI6 IWcF+c11A5V9G4ocij02CtzMkxWrWmRlHtCoOa5wPqZpRgstlp3zlm4Za5vg5sXRjoZ4 NBJgbSUmPpFK3LFr+00KiUx75JECOU0WqKuE8zbtmsw/kOPtFZ6+OwZtXtzZvagcGe+n TGuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=PcNMYMNudJoBk4VTzuaFgC2rlEuEb7C1OiFEkQ0e9dE=; b=BKq5nNOA8dNl5J0HXr+MP0F5gccMzWoLb2kxaNO2yfzv9lafkC0228/O+RvR2usUr7 +UlvJFyDK6Liy8wWikFIjofzj1z1OJ+AgbH8TZwjtAioRP2z+IqSk13o7k4Smw8Zl/En 0tyCK3YfZ8Lko9tcGS5zFofXkqk0MVrG/AbcISkIoEMI9XL6DK0rgR0L83/o66nxAtDf se02cKj8XVmMlLB8YZeAT98bU4hycS8qSUqT/73EtJdBAPGgd1wgX+8jk8N8BmxaLqe+ sZ8tjv05a1dx5k6yh4+vSsSNMDBhOFTE9U221IE9LAJoh/aklhohcLxjyjb/zTeHoC1u ss2A== 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=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 mp18si14523871ejc.505.2021.10.22.03.07.22; Fri, 22 Oct 2021 03:07:48 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232460AbhJVKHu (ORCPT + 99 others); Fri, 22 Oct 2021 06:07:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:57978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbhJVKHt (ORCPT ); Fri, 22 Oct 2021 06:07:49 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24E4C611F2; Fri, 22 Oct 2021 10:05:32 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mdrQX-000tgG-V8; Fri, 22 Oct 2021 11:05:30 +0100 Date: Fri, 22 Oct 2021 11:05:29 +0100 Message-ID: <87o87hbcie.wl-maz@kernel.org> From: Marc Zyngier To: Mark Rutland 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, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, 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 15/15] irq: remove handle_domain_{irq,nmi}() In-Reply-To: <20211021180236.37428-16-mark.rutland@arm.com> References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-16-mark.rutland@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: mark.rutland@arm.com, 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, kernelfans@gmail.com, linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, 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 X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Oct 2021 19:02:36 +0100, Mark Rutland wrote: > > Now that entry code handles IRQ entry (including setting the IRQ regs) > before calling irqchip code, irqchip code can safely call > generic_handle_domain_irq(), and there's no functional reason for it to > call handle_domain_irq(). > > Let's cement this split of responsibility and remove handle_domain_irq() > entirely, updating irqchip drivers to call generic_handle_domain_irq(). > > For consistency, handle_domain_nmi() is similarly removed and replaced > with a generic_handle_domain_nmi() function which also does not perform > any entry logic. > > Previously handle_domain_{irq,nmi}() had a WARN_ON() which would fire > when they were called in an inappropriate context. So that we can > identify similar issues going forward, similar WARN_ON_ONCE() logic is > added to the generic_handle_*() functions, and comments are updated for > clarity and consistency. > > Signed-off-by: Mark Rutland > Cc: Marc Zyngier > Cc: Thomas Gleixner [...] > -/** > - * handle_domain_nmi - Invoke the handler for a HW irq belonging to a domain > - * @domain: The domain where to perform the lookup > - * @hwirq: The HW irq number to convert to a logical one > - * @regs: Register file coming from the low-level handling code > - * > - * This function must be called from an NMI context. > * > - * Returns: 0 on success, or -EINVAL if conversion has failed > - */ > -int handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq, > - struct pt_regs *regs) > + * This function must be called from an NMI context with irq regs > + * initialized. > + **/ > +int generic_handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq) > { > - struct pt_regs *old_regs = set_irq_regs(regs); > - int ret; > - > - /* > - * NMI context needs to be setup earlier in order to deal with tracing. > - */ > - WARN_ON(!in_nmi()); > - > - ret = generic_handle_domain_irq(domain, hwirq); > - > - set_irq_regs(old_regs); > - return ret; > + WARN_ON_ONCE(!in_nmi()); > + return handle_irq_desc(irq_resolve_mapping(domain, hwirq)); > } > -#endif > +EXPORT_SYMBOL_GPL(generic_handle_domain_nmi); nit: we don't need this export (only a root controller can handle NMIs), and that's the sort of thing I would really want to avoid exposing to modules. M. -- Without deviation from the norm, progress is not possible.