Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locking: Introduce prepare_sync_core_cmd()

Introduce an architecture function that architectures can use to set
up ("prepare") SYNC_CORE commands.

The function will be used by RISC-V to update its "deferred icache-
flush" data structures (icache_stale_mask).

Architectures defining prepare_sync_core_cmd() static inline need to
select ARCH_HAS_PREPARE_SYNC_CORE_CMD.

Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/r/20240131144936.29190-4-parri.andrea@gmail.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

authored by

Andrea Parri and committed by
Palmer Dabbelt
4ff4c745 a14d11a0

+19 -1
+15 -1
include/linux/sync_core.h
··· 17 17 } 18 18 #endif 19 19 20 - #endif /* _LINUX_SYNC_CORE_H */ 20 + #ifdef CONFIG_ARCH_HAS_PREPARE_SYNC_CORE_CMD 21 + #include <asm/sync_core.h> 22 + #else 23 + /* 24 + * This is a dummy prepare_sync_core_cmd() implementation that can be used on 25 + * all architectures which provide unconditional core serializing instructions 26 + * in switch_mm(). 27 + * If your architecture doesn't provide such core serializing instructions in 28 + * switch_mm(), you may need to write your own functions. 29 + */ 30 + static inline void prepare_sync_core_cmd(struct mm_struct *mm) 31 + { 32 + } 33 + #endif 21 34 35 + #endif /* _LINUX_SYNC_CORE_H */
+3
init/Kconfig
··· 1970 1970 config ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE 1971 1971 bool 1972 1972 1973 + config ARCH_HAS_PREPARE_SYNC_CORE_CMD 1974 + bool 1975 + 1973 1976 config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE 1974 1977 bool 1975 1978
+1
kernel/sched/membarrier.c
··· 320 320 MEMBARRIER_STATE_PRIVATE_EXPEDITED_SYNC_CORE_READY)) 321 321 return -EPERM; 322 322 ipi_func = ipi_sync_core; 323 + prepare_sync_core_cmd(mm); 323 324 } else if (flags == MEMBARRIER_FLAG_RSEQ) { 324 325 if (!IS_ENABLED(CONFIG_RSEQ)) 325 326 return -EINVAL;