summaryrefslogtreecommitdiff
path: root/arch/riscv
diff options
context:
space:
mode:
authorJisheng Zhang <jszhang@kernel.org>2023-09-12 18:40:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-10 19:16:56 +0300
commitb649a7fe9a8b41a01b608e129a90af09d4b5f52f (patch)
tree0a0cd1021f7488a287b15997473580e3d72db3e1 /arch/riscv
parent5d1e4e5fd1e91af95d25a032e5ad893bb9699929 (diff)
downloadlinux-b649a7fe9a8b41a01b608e129a90af09d4b5f52f.tar.xz
riscv: don't probe unaligned access speed if already done
[ Upstream commit c20d36cc2a2073d4cdcda92bd7a1bb9b3b3b7c79 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/riscv')
-rw-r--r--arch/riscv/kernel/cpufeature.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index 1cfbba65d11a..e12cd22755c7 100644
--- a/arch/riscv/kernel/cpufeature.c
+++ b/arch/riscv/kernel/cpufeature.c
@@ -568,6 +568,10 @@ void check_unaligned_access(int cpu)
void *src;
long speed = RISCV_HWPROBE_MISALIGNED_SLOW;
+ /* 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");