[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211022150617.GC86184@C02TD0UTHF1T.local>
Date: Fri, 22 Oct 2021 16:06:17 +0100
From: Mark Rutland <mark.rutland@....com>
To: Marc Zyngier <maz@...nel.org>
Cc: linux-kernel@...r.kernel.org, aou@...s.berkeley.edu,
catalin.marinas@....com, deanbo422@...il.com, green.hu@...il.com,
guoren@...nel.org, jonas@...thpole.se, kernelfans@...il.com,
linux-arm-kernel@...ts.infradead.org, linux@...linux.org.uk,
nickhu@...estech.com, palmer@...belt.com, paulmck@...nel.org,
paul.walmsley@...ive.com, peterz@...radead.org, shorne@...il.com,
stefan.kristiansson@...nalahti.fi, tglx@...utronix.de,
torvalds@...ux-foundation.org, tsbogend@...ha.franken.de,
vgupta@...nel.org, will@...nel.org
Subject: Re: [PATCH 15/15] irq: remove handle_domain_{irq,nmi}()
On Fri, Oct 22, 2021 at 11:05:29AM +0100, Marc Zyngier wrote:
> On Thu, 21 Oct 2021 19:02:36 +0100,
> Mark Rutland <mark.rutland@....com> 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 <mark.rutland@....com>
> > Cc: Marc Zyngier <maz@...nel.org>
> > Cc: Thomas Gleixner <tglx@...utronix.de>
>
> [...]
>
> > -/**
> > - * 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.
Powered by blists - more mailing lists