Re: [PATCH v2 1/3] MIPS: CPS: Improve mips_cps_first_online_in_cluster()
From: Gregory CLEMENT
Date: Mon Jul 07 2025 - 09:41:15 EST
Hello Jiaxun,
> 在2025年7月4日周五 下午4:13,Gregory CLEMENT写道:
>> The initial implementation of this function goes through all the CPUs
>> in a cluster to determine if the current CPU is the only one
>> running. This process occurs every time the function is called.
>>
>> However, during boot, we already perform this task, so let's take
>> advantage of this opportunity to create and fill a CPU bitmask that
>> can be easily and efficiently used later.
>>
>> This requires creating a single CPU bitmask per cluster, which is why
>> it's essential to know how many clusters can be utilized. The default
>> setting is 4 clusters, but this value can be changed when configuring
>> the kernel or even customized for a given SoC family.
>
> Hmm, I think we should avoid this sort of random limitation.
It's not great, but it seemed like the best approach to keep optimized
boot times and memory consumption.
>
> You can actually store per cluster cpumask_var_t into `mips_cps_cluster_bootcfg`,
> which is allocated in cps_prepare_cpus(), and generate cpumask just
> there.
>
> It should be pretty straightforward to handle.
>
The drawback of this option is that cps_prepare_cpus() is called after
the building of the topology. However, I am trying to see how to insert
this in the loop already used in cps_prepare_cpus().
Gregory
> Thanks!
>
>>
>> This patch modifies the function to allow providing the first
>> available online CPU when one already exists, which is necessary for
>> delay CPU calibration optimization.
>>
>> Signed-off-by: Gregory CLEMENT <gregory.clement@xxxxxxxxxxx>
>> ---
> [...]
> --
> - Jiaxun
--
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com