From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Marc Zyngier <maz@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Arnd Bergmann <arnd@arndb.de>, "Z.Q. Hou" <zhiqiang.hou@nxp.com>,
Biwen Li <biwen.li@nxp.com>,
Sean Anderson <sean.anderson@seco.com>
Subject: Re: [PATCH v3] irqchip/ls-extirq: fix invalid wait context by avoiding to use regmap
Date: Thu, 28 Jul 2022 13:30:57 +0000 [thread overview]
Message-ID: <20220728133056.3lsrlxkc2lhtwhih@skbuf> (raw)
In-Reply-To: <87zggtwuit.wl-maz@kernel.org>
Hello Marc,
On Thu, Jul 28, 2022 at 08:44:58AM +0100, Marc Zyngier wrote:
> On Wed, 27 Jul 2022 17:09:15 +0100,
> Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > The irqchip->irq_set_type method is called by __irq_set_trigger() under
> > the desc->lock raw spinlock.
> >
> > The ls-extirq implementation, ls_extirq_irq_set_type(), uses an MMIO
> > regmap created by of_syscon_register(), which uses plain spinlocks
> > (the kind that are sleepable on RT).
> >
> > Therefore, this is an invalid locking scheme for which we get a kernel
> > splat stating just that ("[ BUG: Invalid wait context ]"), because the
> > context in which the plain spinlock may sleep is atomic due to the raw
> > spinlock. We need to go raw spinlocks all the way.
>
> Interesting you say that...
> > - regmap_update_bits(priv->syscon, priv->intpcr, mask, value);
> > +
> > + intpcr = priv->read(priv->intpcr);
> > + intpcr &= ~mask;
> > + intpcr |= value;
> > + priv->write(priv->intpcr, intpcr);
>
> Which really begs a few questions:
>
> - Where is the locking gone? Sure, the warning is gone. But the driver
> is now broken for *all* configurations, and not only RT. Result!
Correct, I had assumed that calls to irq_chip :: irq_set_type() are
implicitly serialized with respect to each other by means of the irq
descriptor's desc->lock, but clearly that is only true for a single
interrupt line. So I'll add back a lock that keeps the rmw atomic.
> - Is it *really* worth it to have 4 dumb helpers that bring nothing in
> terms of abstraction, and two indirections for something that could
> equally be expressed with a conditional?
Probably not, but it was a choice no worse than going through regmap's
own indirection. I'll try to come up with something that avoids function
pointers.
prev parent reply other threads:[~2022-07-28 13:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 16:09 Vladimir Oltean
2022-07-28 7:44 ` Marc Zyngier
2022-07-28 13:30 ` Vladimir Oltean [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=20220728133056.3lsrlxkc2lhtwhih@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=arnd@arndb.de \
--cc=biwen.li@nxp.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=maz@kernel.org \
--cc=sean.anderson@seco.com \
--cc=tglx@linutronix.de \
--cc=zhiqiang.hou@nxp.com \
/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
all inboxes | Powered by JetHome®