]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RISC-V: Probe misaligned access speed in parallel
authorEvan Green <evan@rivosinc.com>
Mon, 6 Nov 2023 22:58:55 +0000 (14:58 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 7 Nov 2023 23:13:47 +0000 (15:13 -0800)
commit55e0bf49a0d0387d682d696e41cada071f516075
tree49f98f093525d2bcd9ee6d1bca401cbbf7db60d1
parent6eb7a6445b76a2fced91ebcf93d7a9073258c8cf
RISC-V: Probe misaligned access speed in parallel

Probing for misaligned access speed takes about 0.06 seconds. On a
system with 64 cores, doing this in smp_callin() means it's done
serially, extending boot time by 3.8 seconds. That's a lot of boot time.

Instead of measuring each CPU serially, let's do the measurements on
all CPUs in parallel. If we disable preemption on all CPUs, the
jiffies stop ticking, so we can do this in stages of 1) everybody
except core 0, then 2) core 0. The allocations are all done outside of
on_each_cpu() to avoid calling alloc_pages() with interrupts disabled.

For hotplugged CPUs that come in after the boot time measurement,
register CPU hotplug callbacks, and do the measurement there. Interrupts
are enabled in those callbacks, so they're fine to do alloc_pages() in.

Reported-by: Jisheng Zhang <jszhang@kernel.org>
Closes: https://lore.kernel.org/all/mhng-9359993d-6872-4134-83ce-c97debe1cf9a@palmer-ri-x1c9/T/#mae9b8f40016f9df428829d33360144dc5026bcbf
Fixes: 584ea6564bca ("RISC-V: Probe for unaligned access speed")
Signed-off-by: Evan Green <evan@rivosinc.com>
Link: https://lore.kernel.org/r/20231106225855.3121724-1-evan@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/cpufeature.h
arch/riscv/kernel/cpufeature.c
arch/riscv/kernel/smpboot.c