Re: [PATCH v4 19/19] irqdomain: Switch to per-domain locking

Johan Hovold
2023-01-18T10:45:44Z

On Tue, Jan 17, 2023 at 10:50:39PM +0100, Thomas Gleixner wrote:
> On Mon, Jan 16 2023 at 14:50, Johan Hovold wrote:
> > The IRQ domain structures are currently protected by the global
> > irq_domain_mutex. Switch to using more fine-grained per-domain locking,
> > which may potentially speed up parallel probing somewhat.
>
> Does it or not?
>
> If not then why adding all this churn for no real value?

It probably doesn't make much difference, but Marc wanted per-domain
locking:

> I'd really like to avoid a global mutex. At the very least this should
> be a per-domain mutex, otherwise this will serialise a lot more than
> what is needed.

Yeah, I considered that too, but wanted to get your comments on this
first.

Also note that the likewise global irq_domain_mutex (and
sparse_irq_lock) are taken in some of these paths so perhaps using finer
locking won't actually matter that much as this is mostly for parallel
probing.

https://lore.kernel.org/lkml/YuKHiZuNvN+K9NCc@hovoldconsulting.com/

As part of fixing the races, this series has now replaced the per-domain
revmap mutexes with the global irq_domain_mutex, which could possibly be
perceived as a step in the wrong direction in this respect.

This patch restores per-domain locking for non-hierarchical domains and
extends it to hierarchical domains. This leaves the irq_domain_mutex to
only be used for things that actually need a global lock such as the
domain list.

I consider this mostly a clean up, and I did intentionally place it last
in order to not have the fixes depend on it.

Johan