mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
Cc: Anup Patel <anup@brainfault.org>,
	Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Clark Williams <clrkwllms@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Jessica Liu <liu.xuemei1@zte.com.cn>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v3] irqchip/riscv-aplic: fix asynchronous probing
Date: Tue, 13 Oct 2026 17:27:27 +0200	[thread overview]
Message-ID: <20261013152727.2cUDX3l0@linutronix.de> (raw)
In-Reply-To: <20261012-aplic-async-probe-v3-1-5cf52dc28690@mobileye.com>

On 2026-10-12 12:12:59 [+0300], Vladimir Kondratiev wrote:
> boolean flag don't protect from race when probing several instances
> asynchronously. On system with multiple APLICs, if probed asynchronously,
> warning triggered as below.

Why is this async? Doesn't __platform_driver_probe() set it to sync?

> [    0.227210] riscv-aplic 67560000.interrupt-controller: 257 interrupts directly connected to 8 CPUs
> [    0.227210] riscv-aplic 674e0000.interrupt-controller: 257 interrupts directly connected to 8 CPUs
> [    0.227224] ------------[ cut here ]------------
> [    0.227227] list_add double add: new=ffffffff8130ced0, prev=ffffffff8130ced0, next=ffffffff81316d40.
> [    0.227302] WARNING: lib/list_debug.c:35 at __list_add_valid_or_report+0xe0/0xe6, CPU#4: kworker/u97:0/211
> [    0.227322] Modules linked in:
> [    0.227333] CPU: 4 UID: 0 PID: 211 Comm: kworker/u97:0 Not tainted 7.3.0-rc6 #1 PREEMPT_RT
> [    0.227341] Hardware name: EyeQ7H evaluation board (DT)
> [    0.227346] Workqueue: async async_run_entry_fn
> [    0.227358] epc : __list_add_valid_or_report+0xe0/0xe6
> [    0.227366]  ra : __list_add_valid_or_report+0xe0/0xe6
> [    0.227375] epc : ffffffff804a08a0 ra : ffffffff804a08a0 sp : ffffffc600823b90
> [    0.227379]  gp : ffffffff81389e70 tp : ffffffd60135ee00 t0 : 0000000000000000
> [    0.227383]  t1 : 3fffffffffffffff t2 : 0000000000000000 s0 : ffffffc600823bb0
> [    0.227387]  s1 : ffffffff8130ced0 a0 : 0000000000000058 a1 : ffffffd9efc9e5c0
> [    0.227391]  a2 : ffffffd9efd5c510 a3 : 0000000000000000 a4 : 0000000000000000
> [    0.227395]  a5 : 0000000000000000 a6 : ffffffd9efc6e5c0 a7 : bfffffffffffe000
> [    0.227399]  s2 : 0000000000000000 s3 : ffffffff8130ce28 s4 : 0000000000000000
> [    0.227402]  s5 : ffffffd6018b65c8 s6 : 0000000000000000 s7 : ffffffd6012fd605
> [    0.227406]  s8 : ffffffd6010c3400 s9 : 0000000000000000 s10: 0000000000000000
> [    0.227409]  s11: 0000000000000000 t3 : 3fffffffffffe000 t4 : 0000000000000020
> [    0.227413]  t5 : 0000000000000000 t6 : ffffffc6008238f8 ssp : 0000000000000000
> [    0.227417] status: 0000000200000120 badaddr: ffffffff804a08a0 cause: 0000000000000003
> [    0.227422] [<ffffffff804a08a0>] __list_add_valid_or_report+0xe0/0xe6
> [    0.227432] [<ffffffff80558226>] register_syscore+0x30/0x60
> [    0.227444] [<ffffffff804ca0fe>] aplic_probe+0xd2/0xfa
> [    0.227453] [<ffffffff80559b2e>] platform_probe+0x3e/0x7a
> [    0.227461] [<ffffffff8055731a>] really_probe+0x88/0x35c
> [    0.227469] [<ffffffff805576ae>] __driver_probe_device+0xc0/0x13a
> [    0.227478] [<ffffffff805577f4>] driver_probe_device+0x38/0xb2
> [    0.227486] [<ffffffff80557ba6>] __driver_attach_async_helper+0x3c/0xc4
> [    0.227493] [<ffffffff80054a0e>] async_run_entry_fn+0x28/0x154
> [    0.227500] [<ffffffff8004482a>] process_one_work+0x14e/0x3d2
> [    0.227509] [<ffffffff800452fe>] worker_thread+0x144/0x286
> [    0.227516] [<ffffffff8004ca3e>] kthread+0xee/0x10e
> [    0.227524] [<ffffffff8001050a>] ret_from_fork_kernel+0x18/0x14e
> [    0.227532] [<ffffffff807bef36>] ret_from_fork_kernel_asm+0x16/0x18
> [    0.227542] ---[ end trace 0000000000000000 ]---
> [    0.228475] pinctrl-single 48508000.pinctrl: 512 pins, size 2048
> [    0.228500] pinctrl-single 53838000.pinctrl: 512 pins, size 2048
> [    0.228723] pinctrl-single 67107000.pinctrl: 512 pins, size 2048
> [    0.227210] riscv-aplic 674e0000.interrupt-controller: 257 interrupts directly connected to 8 CPUs
> [    0.227224] ------------[ cut here ]------------
> [    0.227227] list_add double add: new=ffffffff8130ced0, prev=ffffffff8130ced0, next=ffffffff81316d40.
> [    0.227302] WARNING: lib/list_debug.c:35 at __list_add_valid_or_report+0xe0/0xe6, CPU#4: kworker/u97:0/211
> [    0.227322] Modules linked in:
> [    0.227333] CPU: 4 UID: 0 PID: 211 Comm: kworker/u97:0 Not tainted 7.3.0-rc6 #1 PREEMPT_RT
> [    0.227341] Hardware name: EyeQ7H evaluation board (DT)
> [    0.227346] Workqueue: async async_run_entry_fn
> [    0.227358] epc : __list_add_valid_or_report+0xe0/0xe6
> [    0.227366]  ra : __list_add_valid_or_report+0xe0/0xe6
> [    0.227375] epc : ffffffff804a08a0 ra : ffffffff804a08a0 sp : ffffffc600823b90
> [    0.227379]  gp : ffffffff81389e70 tp : ffffffd60135ee00 t0 : 0000000000000000
> [    0.227383]  t1 : 3fffffffffffffff t2 : 0000000000000000 s0 : ffffffc600823bb0
> [    0.227387]  s1 : ffffffff8130ced0 a0 : 0000000000000058 a1 : ffffffd9efc9e5c0
> [    0.227391]  a2 : ffffffd9efd5c510 a3 : 0000000000000000 a4 : 0000000000000000
> [    0.227395]  a5 : 0000000000000000 a6 : ffffffd9efc6e5c0 a7 : bfffffffffffe000
> [    0.227399]  s2 : 0000000000000000 s3 : ffffffff8130ce28 s4 : 0000000000000000
> [    0.227402]  s5 : ffffffd6018b65c8 s6 : 0000000000000000 s7 : ffffffd6012fd605
> [    0.227406]  s8 : ffffffd6010c3400 s9 : 0000000000000000 s10: 0000000000000000
> [    0.227409]  s11: 0000000000000000 t3 : 3fffffffffffe000 t4 : 0000000000000020
> [    0.227413]  t5 : 0000000000000000 t6 : ffffffc6008238f8 ssp : 0000000000000000
> [    0.227417] status: 0000000200000120 badaddr: ffffffff804a08a0 cause: 0000000000000003
> [    0.227422] [<ffffffff804a08a0>] __list_add_valid_or_report+0xe0/0xe6
> [    0.227432] [<ffffffff80558226>] register_syscore+0x30/0x60
> [    0.227444] [<ffffffff804ca0fe>] aplic_probe+0xd2/0xfa
> [    0.227453] [<ffffffff80559b2e>] platform_probe+0x3e/0x7a
> [    0.227461] [<ffffffff8055731a>] really_probe+0x88/0x35c
> [    0.227469] [<ffffffff805576ae>] __driver_probe_device+0xc0/0x13a
> [    0.227478] [<ffffffff805577f4>] driver_probe_device+0x38/0xb2
> [    0.227486] [<ffffffff80557ba6>] __driver_attach_async_helper+0x3c/0xc4
> [    0.227493] [<ffffffff80054a0e>] async_run_entry_fn+0x28/0x154
> [    0.227500] [<ffffffff8004482a>] process_one_work+0x14e/0x3d2
> [    0.227509] [<ffffffff800452fe>] worker_thread+0x144/0x286
> [    0.227516] [<ffffffff8004ca3e>] kthread+0xee/0x10e
> [    0.227524] [<ffffffff8001050a>] ret_from_fork_kernel+0x18/0x14e
> [    0.227532] [<ffffffff807bef36>] ret_from_fork_kernel_asm+0x16/0x18
> [    0.227542] ---[ end trace 0000000000000000 ]---

Would you mind providing a coherent description of the problem and
implemented solution instead of slapping console output?

> Fixes: b330fbfd34d7 ("irqchip/riscv-aplic: Register syscore operations only once")
> Signed-off-by: Vladimir Kondratiev <vladimir.kondratiev@mobileye.com>
> ---
> Changes in v3:
> - drop __ro_after_init attribute due to write to read-only page concern

What concern? That __ro_after_init can stay. It is built-in only.

> diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
> index d9afb6ae98cf56d6fd9f858c31a3d23546c3b450..54e1d5602f15a04127e900c0a4983022d49da553 100644
> --- a/drivers/irqchip/irq-riscv-aplic-main.c
> +++ b/drivers/irqchip/irq-riscv-aplic-main.c
> @@ -116,14 +116,12 @@ static struct syscore aplic_syscore = {
>  	.ops = &aplic_syscore_ops,
>  };
>  
> -static bool aplic_syscore_registered __ro_after_init;
> +static atomic_t aplic_syscore_registered = ATOMIC_INIT(0);
>  
>  static void aplic_syscore_init(void)
>  {
> -	if (!aplic_syscore_registered) {
> +	if (!atomic_cmpxchg(&aplic_syscore_registered, 0, 1))
>  		register_syscore(&aplic_syscore);
> -		aplic_syscore_registered = true;
> -	}
>  }
>  
>  static int aplic_pm_notifier(struct notifier_block *nb, unsigned long action, void *data)
> 

Sebastian

      reply	other threads:[~2026-10-13 15:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  9:12 Vladimir Kondratiev
2026-10-13 15:27 ` Sebastian Andrzej Siewior [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=20261013152727.2cUDX3l0@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=clrkwllms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=liu.xuemei1@zte.com.cn \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=radu@rendec.net \
    --cc=rostedt@goodmis.org \
    --cc=tglx@kernel.org \
    --cc=vladimir.kondratiev@mobileye.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®