riscv: Use WRITE_ONCE() when setting page table entries
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Wed, 13 Dec 2023 20:29:58 +0000 (21:29 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 20 Dec 2023 18:48:12 +0000 (10:48 -0800)
commitc30fa83b49897e708a52e122dd10616a52a4c82b
tree215c4b9d87a37bafa00fad4d43b34b4413032628
parentb85ea95d086471afb4ad062012a4d73cd328fa86
riscv: Use WRITE_ONCE() when setting page table entries

To avoid any compiler "weirdness" when accessing page table entries which
are concurrently modified by the HW, let's use WRITE_ONCE() macro
(commit 20a004e7b017 ("arm64: mm: Use READ_ONCE/WRITE_ONCE when accessing
page tables") gives a great explanation with more details).

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20231213203001.179237-2-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/pgtable-64.h
arch/riscv/include/asm/pgtable.h