Re: [PATCH 1/2] regmap: teach regmap to use raw spinlocks if requested in the config

From: Vladimir Oltean
Date: Fri Aug 27 2021 - 12:12:39 EST


On Fri, Aug 27, 2021 at 01:01:35AM +0200, Thomas Gleixner wrote:
> On Wed, Aug 25 2021 at 23:50, Vladimir Oltean wrote:
> > It seems reasonable for regmap to have an option use a raw spinlock too,
> > so add that in the config such that drivers can request it.
>
> What's reasonable about that?
>
> What exactly prevents the regmap locking to use a raw spinlock
> unconditionally?
>
> Even for the case where the regmap is not dealing with irq chips it does
> not make any sense to protect low level operations on shared register
> with a regular spinlock. I might be missing something though...

Mark, any comments?

Generally it is said that misusing raw spinlocks has detrimential
performance upon the real-time aspects of the system, and I don't really
have a good feeling for what constitutes misuse vs what is truly justified
(in fact I did start the thread with "apologies for my novice level of
understanding").

On the other hand, while it does seem a bit too much overhead for
sequences of MMIO reads/writes to be able to be preempted, it doesn't
sound like it would break something either, so...

But I will say that I've tested that and it would solve both my problems
(the stack trace with ls-extirq and the fact that I would like to avoid
reworking the ls-extirq driver too much), as well as problems I never
knew I had: it turns out, armada_37xx_irq_set_type() uses regmap too
(and a sleepable spin lock too - irq_lock). The latter would still have
to be manually patched out.