Re: [PATCH] regmap: Drop map lock during cache init and exit

From: Michael Reeves

Date: Sun Oct 04 2026 - 08:04:01 EST


On Fri, Sep 25, 2026 at 10:22 PM Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> On Fri, Sep 25, 2026 at 08:43:22PM +1000, Michael Reeves via B4 Relay wrote:
>
> > Commit fd4ebc07b4df ("regmap: Hold the regmap lock when allocating and
> > freeing the cache") added the lock for Maple tree lockdep validation.
> > The current Maple tree backend uses internal locking, and cache
> > population is now separate from cache allocation.
>
> Do you have a reference for what you're referencing here? The issue is
> precisely that the maple tree does it's own locking with a spinlock, if
> we ever use the maple tree from a hardirq context the use of the
> spinlock in hardirq context will be tracked and then on removal we'll
> get a locking inversion warning when we try to free it. The maple tree
> locking is entirely unneeded and forces us to jump through these hoops
> but there's no way to turn it off.
I was looking at 94a3a95f0315 ("regcache: Add ->populate() callback to
separate from ->init()") and ed5d499b5c9c ("regcache: maple: Split ->populate()
from ->init()").

I thought separating cache allocation from population meant the map lock
was no longer needed for cache initialization and destruction. But your
explanation makes sense, thank you for pointing it out.

I think I found a cleaner way that avoids that issue, I'm testing it now and
will send v2 shortly if it works.

Thanks,
Michael