Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Lukas Wunner <lukas@wunner.de>,
	maz@kernel.org, Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	linux-gpio@vger.kernel.org,
	Octavian Purdila <octavian.purdila@nxp.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,
	palmer@dabbelt.com, paul.walmsley@sifive.com, shorne@gmail.com,
	stefan.kristiansson@saunalahti.fi, tsbogend@alpha.franken.de,
	vgupta@kernel.org, vladimir.murzin@arm.com, will@kernel.org
Subject: Re: [PATCH v2 17/17] irq: remove handle_domain_{irq,nmi}()
Date: Wed, 11 May 2022 09:11:02 +0100	[thread overview]
Message-ID: <YntvlrKyyhChlmrb@FVFF77S0Q05N> (raw)
In-Reply-To: <874k1xorlj.ffs@tglx>

On Wed, May 11, 2022 at 02:11:52AM +0200, Thomas Gleixner wrote:
> On Tue, May 10 2022 at 15:15, Mark Rutland wrote:
> > On Tue, May 10, 2022 at 02:13:20PM +0200, Lukas Wunner wrote:
> >> Actually, since you're mentioning the in_nmi() check, I suspect
> >> there's another problem here:
> >> 
> >> generic_handle_domain_nmi() warns if !in_nmi(), then calls down 
> >> to handle_irq_desc() which warns if !in_hardirq().  Doesn't this
> >> cause a false-positive !in_hardirq() warning for a NMI on GIC/GICv3?
> >
> > I agree that doesn't look right.
> >
> >> The only driver calling request_nmi() or request_percpu_nmi() is
> >> drivers/perf/arm_pmu.c.  So that's the only one affected.
> >> You may want to test if that driver indeed exhibits such a
> >> false-positive warning since c16816acd086.
> >
> > In testing with v5.18-rc5, I can't see that going wrong.
> >
> > I also hacked the following in:
> >
> > -------->8--------
> > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> > index 939d21cd55c38..3c85608a8779f 100644
> > --- a/kernel/irq/irqdesc.c
> > +++ b/kernel/irq/irqdesc.c
> > @@ -718,6 +718,7 @@ EXPORT_SYMBOL_GPL(generic_handle_domain_irq);
> >  int generic_handle_domain_nmi(struct irq_domain *domain, unsigned int hwirq)
> >  {
> >         WARN_ON_ONCE(!in_nmi());
> > +       WARN_ON_ONCE(!in_hardirq());
> >         return handle_irq_desc(irq_resolve_mapping(domain, hwirq));
> 
> which is pointless because NMI entry code has to invoke [__]nmi_enter()
> before invoking this function. [__]nmi_enter() does:
> 
>     __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET);
> 
> So it's more than bloody obvious why there is no warning triggered for a
> regular hardware induced NMI invocation.

Ugh, yes; clearly I need new eyes and/or more sleep. I entirely missed that we
treat an NMI as *also* being a hardirq rather than something completely
independent, and that means that this is *not* a problem for NMI.

Thanks for pointing that out!

> For a software invocation from the wrong context it does not matter how
> many redundant WARN_ONs you add. The existing ones are covering it
> nicely already.

Yup; as above I was clearly not thinknig straight here.

Mark.

      reply	other threads:[~2022-05-11  8:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211026092504.27071-1-mark.rutland@arm.com>
     [not found] ` <20211026092504.27071-18-mark.rutland@arm.com>
2022-05-06 20:32   ` [PATCH v2 17/17] irq: remove handle_domain_{irq,nmi}() Lukas Wunner
2022-05-09  8:54     ` Mark Rutland
2022-05-09  9:09       ` Marc Zyngier
2022-05-09 13:12         ` Thomas Gleixner
2022-05-10 23:36         ` Thomas Gleixner
2022-05-10 12:13       ` Lukas Wunner
2022-05-10 14:15         ` Mark Rutland
2022-05-10 22:52           ` Thomas Gleixner
2022-05-11  8:23             ` Mark Rutland
2022-05-11  8:57               ` Lukas Wunner
2022-05-11  9:27                 ` Mark Rutland
2022-05-11  0:11           ` Thomas Gleixner
2022-05-11  8:11             ` Mark Rutland [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YntvlrKyyhChlmrb@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=brgl@bgdev.pl \
    --cc=catalin.marinas@arm.com \
    --cc=deanbo422@gmail.com \
    --cc=green.hu@gmail.com \
    --cc=guoren@kernel.org \
    --cc=jonas@southpole.se \
    --cc=kernelfans@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lukas@wunner.de \
    --cc=maz@kernel.org \
    --cc=octavian.purdila@nxp.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=shorne@gmail.com \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=vgupta@kernel.org \
    --cc=vladimir.murzin@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox