On 2024-08-05 17:56:22 [+0100], Mark Brown wrote:
On Mon, Aug 05, 2024 at 05:33:09PM +0200, Sebastian Andrzej Siewior wrote:
I'm not sure if making the lock a raw_spinlock_t solves all the problems. The regmap is regmap_mmio so direct memory-access and looks simple enough to do so. In regmap_mmio_write() I see clk_enable() and and this uses a spinlock_t so we should be back at the same problem.
The clk_enable() is optional, users simply shouldn't use the internal clock management with devices that it'll cause problems for.
There might be an additional problem if reg-caching is enabled.
The flat cache is there mostly for the benefit of things accessed from interrupt context, it guarantees to never do any allocations and doesn't lock. You can also use other caches if you ensure that any registers accessed in interrupt context are already cached so won't trigger any new allocations.
My point is simply that those two things could complicate things further if the desired fix is to (always) use raw_spinlock_t.
Sebastian