linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Johan Hovold <johan@kernel.org>
Cc: Johan Hovold <johan+linaro@kernel.org>,
	Marc Zyngier <maz@kernel.org>,
	x86@kernel.org, platform-driver-x86@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 19/19] irqdomain: Switch to per-domain locking
Date: Mon, 12 Dec 2022 17:18:11 +0100	[thread overview]
Message-ID: <878rjcbnp8.ffs@tglx> (raw)
In-Reply-To: <Y5c6z3t+sV/kIMjF@hovoldconsulting.com>

On Mon, Dec 12 2022 at 15:29, Johan Hovold wrote:
> On Mon, Dec 12, 2022 at 03:14:34PM +0100, Thomas Gleixner wrote:
>> On Fri, Dec 09 2022 at 15:01, 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.
>> >
>> > Note that the domain lock of the root domain (innermost domain) must be
>> > used for hierarchical domains. For non-hierarchical domain (as for root
>> > domains), the new root pointer is set to the domain itself so that
>> > domain->root->mutex can be used in shared code paths.
>> >
>> > Also note that hierarchical domains should be constructed using
>> > irq_domain_create_hierarchy() (or irq_domain_add_hierarchy()) to avoid
>> > poking at irqdomain internals.
>> 
>> While I agree in principle, this change really makes me nervous.
>> 
>> Any fail in setting up domain->root correctly, e.g. by not using
>> irq_domain_create_hierarchy(), cannot be detected and creates nasty to
>> debug race conditions.
>> 
>> So we need some debug mechanism which allows to validate that
>> domain->root is set up correctly when domain->parent != NULL.
>
> Lockdep will catch that due to the
>
> 	lockdep_assert_held(&domain->root->mutex);
>
> I added to irq_domain_set_mapping() and which is is called for each
> (inner) domain in a hierarchy when allocating an IRQ.

Hmm. Indeed that should do the trick.

Some comments would be appreciated as the rules around domain->root are
far from obvious.

Thanks,

        tglx

  reply	other threads:[~2022-12-12 16:18 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 14:01 [PATCH v3 00/19] irqdomain: fix mapping race and clean up locking Johan Hovold
2022-12-09 14:01 ` [PATCH v3 01/19] irqdomain: Drop bogus fwspec-mapping error handling Johan Hovold
2022-12-09 14:01 ` [PATCH v3 02/19] irqdomain: Drop dead domain-name assignment Johan Hovold
2022-12-09 14:01 ` [PATCH v3 03/19] irqdomain: Drop leftover brackets Johan Hovold
2022-12-12 22:44   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 04/19] irqdomain: Fix association race Johan Hovold
2022-12-09 14:01 ` [PATCH v3 05/19] irqdomain: Fix disassociation race Johan Hovold
2022-12-09 14:01 ` [PATCH v3 06/19] irqdomain: Drop revmap mutex Johan Hovold
2022-12-09 14:01 ` [PATCH v3 07/19] irqdomain: Look for existing mapping only once Johan Hovold
2022-12-09 14:01 ` [PATCH v3 08/19] irqdomain: Refactor __irq_domain_alloc_irqs() Johan Hovold
2022-12-09 14:01 ` [PATCH v3 09/19] irqdomain: Fix mapping-creation race Johan Hovold
2022-12-09 14:01 ` [PATCH v3 10/19] irqdomain: Clean up irq_domain_push/pop_irq() Johan Hovold
2022-12-12 22:32   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 11/19] x86/ioapic: Use irq_domain_create_hierarchy() Johan Hovold
2022-12-12 22:37   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 12/19] x86/apic: " Johan Hovold
2022-12-12 22:41   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 13/19] irqchip/alpine-msi: Use irq_domain_add_hierarchy() Johan Hovold
2022-12-12 22:41   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 14/19] irqchip/gic-v2m: Use irq_domain_create_hierarchy() Johan Hovold
2022-12-12 22:42   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 15/19] irqchip/gic-v3-its: " Johan Hovold
2022-12-09 14:01 ` [PATCH v3 16/19] irqchip/gic-v3-mbi: " Johan Hovold
2022-12-12 22:42   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 17/19] irqchip/loongson-pch-msi: " Johan Hovold
2022-12-12 22:36   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 18/19] irqchip/mvebu-odmi: " Johan Hovold
2022-12-12 22:37   ` Philippe Mathieu-Daudé
2022-12-09 14:01 ` [PATCH v3 19/19] irqdomain: Switch to per-domain locking Johan Hovold
2022-12-12 14:14   ` Thomas Gleixner
2022-12-12 14:29     ` Johan Hovold
2022-12-12 16:18       ` Thomas Gleixner [this message]
2023-01-11 18:28         ` Thomas Gleixner
2023-01-12 17:21           ` Johan Hovold
2022-12-09 15:51 ` [PATCH v3 00/19] irqdomain: fix mapping race and clean up locking Thomas Gleixner
2022-12-09 16:16   ` Johan Hovold
2022-12-09 19:53     ` Thomas Gleixner
2022-12-15  9:31 ` Hsin-Yi Wang
2023-01-16 13:53   ` Johan Hovold
2022-12-20  3:30 ` [PATCH v3 0/19] " Mark-PK Tsai
2023-01-16 13:55   ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rjcbnp8.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=johan+linaro@kernel.org \
    --cc=johan@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).