linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] riscv: Use READ_ONCE()/WRITE_ONCE() for pte accesses
@ 2023-12-13 20:29 Alexandre Ghiti
  2023-12-13 20:29 ` [PATCH v2 1/4] riscv: Use WRITE_ONCE() when setting page table entries Alexandre Ghiti
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Alexandre Ghiti @ 2023-12-13 20:29 UTC (permalink / raw)
  To: Russell King, Ryan Roberts, Alexander Potapenko, Marco Elver,
	Dmitry Vyukov, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Anup Patel, Atish Patra, Ard Biesheuvel, Andrey Ryabinin,
	Andrey Konovalov, Vincenzo Frascino, kasan-dev, linux-riscv,
	linux-kernel, kvm, kvm-riscv, linux-efi, linux-mm
  Cc: Alexandre Ghiti

This series is a follow-up for riscv of a recent series from Ryan [1] which
converts all direct dereferences of pte_t into a ptet_get() access.

The goal here for riscv is to use READ_ONCE()/WRITE_ONCE() for all page
table entries accesses to avoid any compiler transformation when the
hardware can concurrently modify the page tables entries (A/D bits for
example).

I went a bit further and added pud/p4d/pgd_get() helpers as such concurrent
modifications can happen too at those levels.

[1] https://lore.kernel.org/all/20230612151545.3317766-1-ryan.roberts@arm.com/

Changes in v2:
- Fix the kernel test report on arm32
- Remove the pte suffix patch
- Fix pud_offset/p4d_offset which were missing the use of accessors
- Rebase on top of 6.7-rc4

Alexandre Ghiti (4):
  riscv: Use WRITE_ONCE() when setting page table entries
  mm: Introduce pudp/p4dp/pgdp_get() functions
  riscv: mm: Only compile pgtable.c if MMU
  riscv: Use accessors to page table entries instead of direct
    dereference

 arch/arm/include/asm/pgtable.h      |  2 ++
 arch/riscv/include/asm/kfence.h     |  4 +--
 arch/riscv/include/asm/pgtable-64.h | 22 +++----------
 arch/riscv/include/asm/pgtable.h    | 33 +++++--------------
 arch/riscv/kernel/efi.c             |  2 +-
 arch/riscv/kvm/mmu.c                | 22 ++++++-------
 arch/riscv/mm/Makefile              |  3 +-
 arch/riscv/mm/fault.c               | 16 ++++-----
 arch/riscv/mm/hugetlbpage.c         | 12 +++----
 arch/riscv/mm/kasan_init.c          | 45 +++++++++++++------------
 arch/riscv/mm/pageattr.c            | 44 ++++++++++++-------------
 arch/riscv/mm/pgtable.c             | 51 ++++++++++++++++++++++++++---
 include/linux/pgtable.h             | 21 ++++++++++++
 13 files changed, 157 insertions(+), 120 deletions(-)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-12-14  5:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-13 20:29 [PATCH v2 0/4] riscv: Use READ_ONCE()/WRITE_ONCE() for pte accesses Alexandre Ghiti
2023-12-13 20:29 ` [PATCH v2 1/4] riscv: Use WRITE_ONCE() when setting page table entries Alexandre Ghiti
2023-12-13 20:29 ` [PATCH v2 2/4] mm: Introduce pudp/p4dp/pgdp_get() functions Alexandre Ghiti
2023-12-13 20:30 ` [PATCH v2 3/4] riscv: mm: Only compile pgtable.c if MMU Alexandre Ghiti
2023-12-13 20:30 ` [PATCH v2 4/4] riscv: Use accessors to page table entries instead of direct dereference Alexandre Ghiti
2023-12-14  5:34   ` Anup Patel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox