From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 735ECC433F5 for ; Fri, 22 Oct 2021 15:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D37F611CB for ; Fri, 22 Oct 2021 15:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233202AbhJVPIp (ORCPT ); Fri, 22 Oct 2021 11:08:45 -0400 Received: from foss.arm.com ([217.140.110.172]:55510 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233073AbhJVPIm (ORCPT ); Fri, 22 Oct 2021 11:08:42 -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 B2E661FB; Fri, 22 Oct 2021 08:06:24 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.73.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 33DB23F694; Fri, 22 Oct 2021 08:06:20 -0700 (PDT) Date: Fri, 22 Oct 2021 16:06:17 +0100 From: Mark Rutland To: Marc Zyngier 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}() Message-ID: <20211022150617.GC86184@C02TD0UTHF1T.local> References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-16-mark.rutland@arm.com> <87o87hbcie.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87o87hbcie.wl-maz@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 11:05:29AM +0100, Marc Zyngier wrote: > 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. Sure, I'll drop that; I'd only added that for symmetry with generic_handle_domain_irq(), and I don't need it to be exported. Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8225C433F5 for ; Fri, 22 Oct 2021 15:07:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 734076054F for ; Fri, 22 Oct 2021 15:07:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 734076054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UUmtOuZKIrEIxr+TVIMVYlgBtNuSCGk0neBo41aEiz0=; b=Va94dJBvjJJEfm HsLhl192vw7xq5LStmSiNBpP+rbuMiGxjXi/bkvXecpqR1QnoG97vxytumHfaNUIwel9LMfVL8Yc5 7wRk/270ocSfPHwJ5BbiPbrv7eXWl8yG1kPFfSFCzbJzagI2GM1pVkoPfV+rVnYMvbpDP3bYxWECI NKdm4uO4V3Bi3papWwXRnGDCXATRdqwERQ7PYaHUzliTXVO0zygI9kefrMjcNjnBsC8Xk+e9wRzhb TqjUBKgyjkl4813+YjbC7yf27TIyMZmP+hAct/emXMZpnu5GNgOgTLRZB3LmYfARVnoQfK+IElP9X F0YKVECzYuBlZzhHGFEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdw7r-00BM7z-Ka; Fri, 22 Oct 2021 15:06:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdw7n-00BM6M-La for linux-arm-kernel@lists.infradead.org; Fri, 22 Oct 2021 15:06:29 +0000 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 B2E661FB; Fri, 22 Oct 2021 08:06:24 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.73.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 33DB23F694; Fri, 22 Oct 2021 08:06:20 -0700 (PDT) Date: Fri, 22 Oct 2021 16:06:17 +0100 From: Mark Rutland To: Marc Zyngier 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}() Message-ID: <20211022150617.GC86184@C02TD0UTHF1T.local> References: <20211021180236.37428-1-mark.rutland@arm.com> <20211021180236.37428-16-mark.rutland@arm.com> <87o87hbcie.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87o87hbcie.wl-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_080627_809869_D53FDD35 X-CRM114-Status: GOOD ( 24.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 22, 2021 at 11:05:29AM +0100, Marc Zyngier wrote: > 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. Sure, I'll drop that; I'd only added that for symmetry with generic_handle_domain_irq(), and I don't need it to be exported. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel