mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Kondratiev <Vladimir.Kondratiev@mobileye.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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: Thu, 15 Oct 2026 09:19:26 +0300	[thread overview]
Message-ID: <46eaa0f0-ff72-4a72-91c8-b610be2d893a@mobileye.com> (raw)
In-Reply-To: <20261014105312.xNkvgkGg@linutronix.de>

On 10/14/26 13:53, Sebastian Andrzej Siewior wrote:
> EXTERNAL EMAIL: Do not click any links or open any attachments unless you trust the sender and know the content is safe.
> 
> On 2026-10-14 11:15:05 [+0300], Vladimir Kondratiev wrote:
>> On 10/13/26 18:27, Sebastian Andrzej Siewior wrote:
>>> EXTERNAL EMAIL: Do not click any links or open any attachments unless you trust the sender and know the content is safe.
>>>
>>> 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?
>>
>> Yes it does but aplic driver uses
>>
>> builtin_platform_driver(aplic_driver);
>>
>> that takes different route. Easy way to directly proof it: I boot with
>>
>> driver_async_probe=* dyndbg=\"func __driver_attach +p\"
>>
>> to request asynchronous probe and debug prints in the __driver_attach
>> shows:
>> [    0.236483] platform 48760000.interrupt-controller: probing driver riscv-aplic asynchronously
>> [    0.236513] platform 674e0000.interrupt-controller: probing driver riscv-aplic asynchronously
>> [    0.236539] platform 67560000.interrupt-controller: probing driver riscv-aplic asynchronously
> 
> Does "driver_async_probe=*" mark _all_ drivers as safe and you run into
> a problem where a driver isn't safe? Does the "dyndbg=" argument show
> the driver is probed asynchronously if you omit the "driver_async_probe"
> argument?

Not exactly, "driver_async_probe=*" in bootargs request only drivers that has
PROBE_DEFAULT_STRATEGY to be probed asynchronously.

aplic_driver don't set probe_type thus it defaults to PROBE_DEFAULT_STRATEGY,
quote exact definition from kdoc:
 * @PROBE_DEFAULT_STRATEGY: Used by drivers that work equally well
 *	whether probed synchronously or asynchronously.

If driver is no capable of async probing it should use PROBE_FORCE_SYNCHRONOUS.
3-rd option for probe_type is PROBE_PREFER_ASYNCHRONOUS

Direct test shows exactly this: that "dyndbg=" argument prints
"probing driver riscv-aplic asynchronously" if I set "driver_async_probe=*"
and prints nothing, meaning driver probed synchronously,
without "driver_async_probe=*"

> So the question is do we want to let it probe asynchronously or should
> we force it to sync.

I see no reason for PROBE_FORCE_SYNCHRONOUS to prohibit asynchronous probing.
code itself is capable of asynchronous probing. Preference for particular
platform can be specified in the bootargs.
> 
>>> Would you mind providing a coherent description of the problem and
>>> implemented solution instead of slapping console output?
>>
>> Sorry if it was not clear; shall I explain in details why pattern
>>
>> if (!done) {
>> 	do_something();
>> 	done = true;
>> }
>>
>> is not SMP safe? Add detailed explanation to commit message and shorten console output?
> 
> No console output at all. You need to coherently explain the problem
> without adding console output. This is a simple problem, there is no
> need to for a huge commit message here. Also there is no need for SMP
> here as we do have kernel preemption.

Got it. Will do. 

> 
>> Reason for asynchronous probing is simple - to reduce boot time, it is critical for embedded
>> systems. Think of system managing car rear camera and proximity sensors, it should be ready when you
>> start driving, this lefts very short time for the kernel to boot.
> 
> So the driver does not support async probing and you add it and call it
> a fix? I don't mind async probing but it should be declared what the
> actual intention is. And maybe the driver should be marked async in the
> end.

As above, drive declares it is agnostic to probe type, supporting both. So
I do think it is a fix.

>>>> ---
>>>> 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.
>> See comment to v2 by sachiko-bot$kernel.org here
>> https://lore.kernel.org/all/sashiko-outbox-167856@kernel.org/
>> quote:
>> ---cut---
>> [Severity: High]
>>
>> Will this trigger a fatal page fault if the probe is deferred?
>>
> …
>> Platform driver probes can be deferred (for instance, waiting for an MSI
>>
>> domain) and run in a workqueue after the init phase is done.
> …
>> and indeed, aplic_msi_setup() can return -EPROBE_DEFER so concern is valid and
>> existed in original code, it is not related to asynchronous probing
> 
> I would not expect the MSI domain to be probed after kernel booting via
> a module. This is the scenario where this would explode.
> And if you consider this a problem you should address it and denote it
> in the commit description as such and not silently changing it as part
> of another change without any explanation.

OK, will add explanation for this.
This driver can't be a module, it is "builtin_platform_driver(aplic_driver);"
but still probe may be deferred if of node has "msi-parent", see
aplic_msi_setup() - it can return -EPROBE_DEFER;

Thanks, Vladimir

  reply	other threads:[~2026-10-15  6:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12  9:12 Vladimir Kondratiev
2026-10-13 15:27 ` Sebastian Andrzej Siewior
2026-10-14  8:15   ` Vladimir Kondratiev
2026-10-14 10:53     ` Sebastian Andrzej Siewior
2026-10-15  6:19       ` Vladimir Kondratiev [this message]
2026-10-15  6:32         ` Sebastian Andrzej Siewior
2026-10-15  8:11           ` Vladimir Kondratiev
2026-10-15  9:56             ` Sebastian Andrzej Siewior
2026-10-15 13:52               ` Vladimir Kondratiev

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=46eaa0f0-ff72-4a72-91c8-b610be2d893a@mobileye.com \
    --to=vladimir.kondratiev@mobileye.com \
    --cc=alex@ghiti.fr \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=bigeasy@linutronix.de \
    --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 \
    /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®