+1
−1
+1
−0
arch/riscv/include/asm/membarrier.h
0 → 100644
+31
−0
+2
−0
+3
−2
Loading
stable inclusion from stable-v6.6.51 commit a2977c0ca3e97dc4c1665f27117810902fdeb0a9 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAYRVR Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a2977c0ca3e97dc4c1665f27117810902fdeb0a9 -------------------------------- commit d6cfd1770f20392d7009ae1fdb04733794514fa9 upstream. The membarrier system call requires a full memory barrier after storing to rq->curr, before going back to user-space. The barrier is only needed when switching between processes: the barrier is implied by mmdrop() when switching from kernel to userspace, and it's not needed when switching from userspace to kernel. Rely on the feature/mechanism ARCH_HAS_MEMBARRIER_CALLBACKS and on the primitive membarrier_arch_switch_mm(), already adopted by the PowerPC architecture, to insert the required barrier. Fixes: fab957c1 ("RISC-V: Atomic and Locking Code") 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-2-parri.andrea@gmail.com Signed-off-by:
Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by:
WangYuli <wangyuli@uniontech.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Wen Zhiwei <wenzhiwei@kylinos.cn>