Skip to content

Commit db6f8fc

Browse files
gclementtsbogend
authored andcommitted
MIPS: CPS: Optimise delay CPU calibration for SMP
On MIPS architecture with CPS-based SMP support, all CPU cores in the same cluster run at the same frequency since they share the same L2 cache, requiring a fixed CPU/L2 cache ratio. This allows to implement calibrate_delay_is_known(), which will return 0 (triggering calibration) only for the primary CPU of each cluster. For other CPUs, we can simply reuse the value from their cluster's primary CPU core. With the introduction of this patch, a configuration running 32 cores spread across two clusters sees a significant reduction in boot time by approximately 600 milliseconds. Reviewed-by: Jiaxun Yang <[email protected]> Signed-off-by: Gregory CLEMENT <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent c71085f commit db6f8fc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/mips/kernel/smp-cps.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,17 @@ static void __init cps_smp_setup(void)
281281
#endif /* CONFIG_MIPS_MT_FPAFF */
282282
}
283283

284+
unsigned long calibrate_delay_is_known(void)
285+
{
286+
int first_cpu_cluster = 0;
287+
288+
/* The calibration has to be done on the primary CPU of the cluster */
289+
if (mips_cps_first_online_in_cluster(&first_cpu_cluster))
290+
return 0;
291+
292+
return cpu_data[first_cpu_cluster].udelay_val;
293+
}
294+
284295
static void __init cps_prepare_cpus(unsigned int max_cpus)
285296
{
286297
unsigned int nclusters, ncores, core_vpes, nvpe = 0, c, cl, cca;

0 commit comments

Comments
 (0)