diff options
| author | Michael Reeves <michael.reeves077@gmail.com> | 2026-10-06 18:03:16 +1100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-13 00:11:44 +0100 |
| commit | abff0a48b110fe52d43999b4cb7c793a510a6bf1 (patch) | |
| tree | 12d681a12884969f15e77022201887d9c9b061ad /scripts/Makefile.thinlto | |
| parent | 834035934cef9e60169de682f4dc9feafd49e51a (diff) | |
| download | linux-next-abff0a48b110fe52d43999b4cb7c793a510a6bf1.tar.gz linux-next-abff0a48b110fe52d43999b4cb7c793a510a6bf1.zip | |
regmap: Drop map lock during cache init and exit
On systems with CONFIG_PROVE_RAW_LOCK_NESTING enabled, Apple GPIO probe
triggers an "Invalid wait context" lockdep warning.
The driver uses a regmap with a raw spinlock and REGCACHE_FLAT. During
regcache_init(), regcache_flat_init() allocates memory while holding the
raw spinlock. The memory allocator can acquire a non-raw spinlock, which
causes an invalid raw-to-non-raw lock nesting error. The abbreviated call
chain is:
apple_gpio_pinctrl_probe
regcache_init
regcache_flat_init
__kmalloc_noprof
__pcs_replace_empty_main
refill_objects
_raw_spin_lock_irqsave
Cache allocation occurs before the regmap is published, cache destruction
occurs after users have stopped accessing it, and regmap_reinit_cache()
requires callers to prevent concurrent access. Remove the outer map lock
from cache initialization and destruction. Keep it for cache population
and normal register access.
The Maple cache still uses its internal spinlock during teardown. That
lock can also be acquired from hard IRQ context during register access.
Add Maple-state irqsave helpers and use them during teardown to preserve
the lock's IRQ-safe lockdep state.
Fixes: fd4ebc07b4df ("regmap: Hold the regmap lock when allocating and freeing the cache")
Suggested-by: Mark Brown <broonie@kernel.org>
Suggested-by: Liam R. Howlett <liam@infradead.org>
Signed-off-by: Michael Reeves <michael.reeves077@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261006-regcache-lifecycle-submit-v3-2-37bdd82fd47c@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
