lkml.org 
[lkml]   [2022]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] irqdomain: Fix irqdomain->revmap race
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

\
 
 \ /
  Last update: 2022-12-19 15:35    [W:0.026 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site