[PATCH v1 0/7] riscv: add Svnapot-based contiguous PTE support
Yunhui Cui <[email protected]>
| Newsgroups | org.kernel.vger.linux-efi,org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi, First of all, thanks to Ryan Roberts for the work on mTHP and Contiguous PTE support on arm64. That work provides a very useful reference for reducing page fault overhead and TLB pressure for large but still PTE-mapped memory ranges. This series adds Svnapot-based contiguous PTE support for RISC-V. To achieve similar benefits on RISC-V, this series introduces a Contiguous-PTE-like mechanism built on top of the Svnapot extension. The intent is to preserve the core-MM PTE semantics while allowing RISC-V to transparently fold eligible base-page mappings into Svnapot-encoded contiguous mappings when possible. The series splits the low-level raw PTE helpers from the public core-MM-facing PTE helpers, so that: -the __xxx helpers expose the raw hardware PTE encoding, -the xxx helpers provide the semantic view expected by core MM, -and Svnapot-aware handling is centralized in the public wrapper layer. Performance results: -Compared with the native 4K base-page setup, the mTHP + PTE fold scheme improves overall SPEC CPU performance by about 2%. -The native 4K page setup shows higher memory access latency, and its memory read latency is about 12% higher than this scheme. Yunhui Cui (7): riscv: mm: split raw and public PTE helpers riscv/kvm: use raw PTE helpers for G-stage leaf PTEs riscv: mm: add Svnapot-aware contiguous PTE wrappers riscv: hugetlb: switch NAPOT mappings to raw PTE helpers riscv: add contiguous PTE range clearing helpers riscv: batch write-protect contiguous PTE ranges riscv: add Svnapot-aware pte_batch_hint support arch/riscv/include/asm/kfence.h | 4 +- arch/riscv/include/asm/pgtable.h | 455 +++++++++++++++++++++- arch/riscv/kernel/efi.c | 4 +- arch/riscv/kernel/hibernate.c | 2 +- arch/riscv/kvm/gstage.c | 48 +-- arch/riscv/kvm/mmu.c | 4 +- arch/riscv/mm/Makefile | 1 + arch/riscv/mm/contpte.c | 650 +++++++++++++++++++++++++++++++ arch/riscv/mm/fault.c | 4 +- arch/riscv/mm/hugetlbpage.c | 55 ++- arch/riscv/mm/init.c | 8 +- arch/riscv/mm/kasan_init.c | 14 +- arch/riscv/mm/pageattr.c | 12 +- arch/riscv/mm/pgtable.c | 58 ++- 14 files changed, 1222 insertions(+), 97 deletions(-) create mode 100644 arch/riscv/mm/contpte.c -- 2.39.5