Patch "riscv: Flush the instruction cache during SMP bringup" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    riscv: Flush the instruction cache during SMP bringup

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     riscv-flush-the-instruction-cache-during-smp-bringup.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a1973fa43d40e50fc0245a8ca7bcd30e7dfddb5c
Author: Samuel Holland <samuel.holland@xxxxxxxxxx>
Date:   Tue Mar 26 21:49:42 2024 -0700

    riscv: Flush the instruction cache during SMP bringup
    
    [ Upstream commit 58661a30f1bcc748475ffd9be6d2fc9e4e6be679 ]
    
    Instruction cache flush IPIs are sent only to CPUs in cpu_online_mask,
    so they will not target a CPU until it calls set_cpu_online() earlier in
    smp_callin(). As a result, if instruction memory is modified between the
    CPU coming out of reset and that point, then its instruction cache may
    contain stale data. Therefore, the instruction cache must be flushed
    after the set_cpu_online() synchronization point.
    
    Fixes: 08f051eda33b ("RISC-V: Flush I$ when making a dirty page executable")
    Reviewed-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
    Signed-off-by: Samuel Holland <samuel.holland@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240327045035.368512-2-samuel.holland@xxxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
index 519b6bd946e5d..bbdb9ec62df0a 100644
--- a/arch/riscv/kernel/smpboot.c
+++ b/arch/riscv/kernel/smpboot.c
@@ -26,7 +26,7 @@
 #include <linux/sched/task_stack.h>
 #include <linux/sched/mm.h>
 
-#include <asm/cpufeature.h>
+#include <asm/cacheflush.h>
 #include <asm/cpu_ops.h>
 #include <asm/cpufeature.h>
 #include <asm/irq.h>
@@ -239,9 +239,10 @@ asmlinkage __visible void smp_callin(void)
 	riscv_user_isa_enable();
 
 	/*
-	 * Remote TLB flushes are ignored while the CPU is offline, so emit
-	 * a local TLB flush right now just in case.
+	 * Remote cache and TLB flushes are ignored while the CPU is offline,
+	 * so flush them both right now just in case.
 	 */
+	local_flush_icache_all();
 	local_flush_tlb_all();
 	complete(&cpu_running);
 	/*




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux