From 4924e09a46fd8429fbe5e1688793b3dcd4dd3b6c Mon Sep 17 00:00:00 2001 From: Jesse Taube Date: Tue, 11 Mar 2025 08:51:19 +0900 Subject: [PATCH] RISC-V: Scalar unaligned access emulated on hotplug CPUs BugLink: https://bugs.launchpad.net/bugs/2101915 commit 9c528b5f7927b857b40f3c46afbc869827af3c94 upstream. The check_unaligned_access_emulated() function should have been called during CPU hotplug to ensure that if all CPUs had emulated unaligned accesses, the new CPU also does. This patch adds the call to check_unaligned_access_emulated() in the hotplug path. Fixes: 55e0bf49a0d0 ("RISC-V: Probe misaligned access speed in parallel") Signed-off-by: Jesse Taube Reviewed-by: Evan Green Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20241017-jesse_unaligned_vector-v10-2-5b33500160f8@rivosinc.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman [koichiroden: applied to an older path due to missing commits: f413aae96cda ("riscv: Set unaligned access speed at compile time")] Signed-off-by: Koichiro Den Signed-off-by: Stefan Bader --- arch/riscv/kernel/cpufeature.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index ec1852f47b28..17ed4a4fbe5c 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -903,6 +903,7 @@ static int riscv_online_cpu(unsigned int cpu) if (per_cpu(misaligned_access_speed, cpu) != RISCV_HWPROBE_MISALIGNED_UNKNOWN) goto exit; + check_unaligned_access_emulated(NULL); buf = alloc_pages(GFP_KERNEL, MISALIGNED_BUFFER_ORDER); if (!buf) { pr_warn("Allocation failure, not measuring misaligned performance\n");