From: Johan Hovold <johan@kernel.org>
To: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Cc: Marc Zyngier <maz@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Matthias Brugger <matthias.bgg@gmail.com>,
yj.chiang@mediatek.com, phil.chang@mediatek.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] irqdomain: Fix irqdomain->revmap race
Date: Mon, 19 Dec 2022 15:35:33 +0100 [thread overview]
Message-ID: <Y6B2tTQCLXz/Oytt@hovoldconsulting.com> (raw)
In-Reply-To: <20221219130620.21092-1-mark-pk.tsai@mediatek.com>
On Mon, Dec 19, 2022 at 09:06:15PM +0800, Mark-PK Tsai wrote:
> The irqdomain->revmap(_tree) of a shared irq can be race updated
> as following, which result in an unexpected irq mapping:
>
> ---------------------------------------------------------------
> (2 threads parse the same hwirq fwspec in the same time.)
>
> Thread A Thread B
> irq_create_fwspec_mapping
> irq_find_mapping Thread A: virq = 0, alloc a new irq_desc
> irq_create_fwspec_mapping
> irq_find_mapping Thread B: virq = 0, alloc a new irq_desc
> irq_domain_alloc_irqs
> irq_domain_insert_irq domain->revmap[hwirq] = irq_data(virq x)
> irq_domain_alloc_irqs
> irq_domain_insert_irq domain->revmap[hwirq] = irq_data(virq x + 1)
>
> virq = x virq = x + 1
> ---------------------------------------------------------------
>
> The virq x can't work because the revmap[hwirq] was
> overridden by thread B.
>
> It seems both hierarchy and non-hierarchy irq domain have the same
> problem because the code from irq_find_mapping to revmap update are
> not protected by a same lock.
>
> Do you have any suggestion about how to fix it properly?
This is being fixed here:
https://lore.kernel.org/lkml/20221209140150.1453-1-johan+linaro@kernel.org/
Johan
prev parent reply other threads:[~2022-12-19 14:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 13:06 Mark-PK Tsai
2022-12-19 14:35 ` Johan Hovold [this message]
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=Y6B2tTQCLXz/Oytt@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mark-pk.tsai@mediatek.com \
--cc=matthias.bgg@gmail.com \
--cc=maz@kernel.org \
--cc=phil.chang@mediatek.com \
--cc=tglx@linutronix.de \
--cc=yj.chiang@mediatek.com \
/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
all inboxes | Powered by JetHome®