]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
riscv: don't probe unaligned access speed if already done
authorJisheng Zhang <jszhang@kernel.org>
Tue, 12 Sep 2023 15:40:40 +0000 (23:40 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Sun, 5 Nov 2023 17:05:51 +0000 (09:05 -0800)
If misaligned_access_speed percpu var isn't so called "HWPROBE
MISALIGNED UNKNOWN", it means the probe has happened(this is possible
for example, hotplug off then hotplug on one cpu), and the percpu var
has been set, don't probe again in this case.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Fixes: 584ea6564bca ("RISC-V: Probe for unaligned access speed")
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230912154040.3306-1-jszhang@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/cpufeature.c

index 970a71422beea88b337cf06403980026513de0a6..6a01ded615cdb7c4d6e4b28f50353dffaa038ce4 100644 (file)
@@ -572,6 +572,10 @@ void check_unaligned_access(int cpu)
        if (check_unaligned_access_emulated(cpu))
                return;
 
+       /* We are already set since the last check */
+       if (per_cpu(misaligned_access_speed, cpu) != RISCV_HWPROBE_MISALIGNED_UNKNOWN)
+               return;
+
        page = alloc_pages(GFP_NOWAIT, get_order(MISALIGNED_BUFFER_SIZE));
        if (!page) {
                pr_warn("Can't alloc pages to measure memcpy performance");