Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <jiaxun.yang@flygoat.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Gregory CLEMENT and committed by
Thomas Bogendoerfer
db6f8fcd c71085f2

+11
+11
arch/mips/kernel/smp-cps.c
··· 281 281 #endif /* CONFIG_MIPS_MT_FPAFF */ 282 282 } 283 283 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 + 284 295 static void __init cps_prepare_cpus(unsigned int max_cpus) 285 296 { 286 297 unsigned int nclusters, ncores, core_vpes, nvpe = 0, c, cl, cca;