PTE Reserved-for-Software Bits 60-59
About
Specification Name: PTE Reserved-for-Software Bits 60-59
Task Group: Fast-Track
Task Group Charter: N/A
Background
Operating systems, such as FreeBSD [1], Linux [2], and Windows [3], frequently use reserved bits within Page Table Entries (PTEs) to store metadata for advanced memory management features, such as page access tracking, and software-managed dirty bits. Embedding these metadata bits directly within the PTEs allows for fast access with minimal overhead, avoiding costly lookup in auxiliary data structures.
Currently, RISC-V reserves two bits in PTEs for software use. However, modern operating systems like Linux require at least three metadata bits to fully support key features and a feature needing a fourth bit appears to be on the horizon.
This limitation forces kernel developers to make a compile-time trade off, selecting only two out of three
possible functionalities [4]. For further details see this this thread on the Linux kernel mail list.
We propose a fast-track extension called Svrsw60t59b
to address this limitation.
Overview
The Svrsw60t59b extension addresses this by introducing two additional software-reserved bits, increasing the total from two to four. This not only resolves the immediate constraint, enabling full support for existing use cases, but also provides an extra bit for future expansion, ensuring compatibility with evolving operating system requirements.
A companion IOMMU non-ISA extension is added to enumerate the support of Svrsw60t59b in the IOMMU using a capability register bit.
Stakeholders Identification
Privileged IC
IOMMU TG
SoC Infra. HC
Priv. SW HC
Virtualization SIG
References: Active Groups and Specifications Under Development
Design Considerations
The Svrsw60t59b extension addresses the limitation of RSW bits in PTEs by introducing two additional software-reserved bits, increasing the total from two to four. This not only resolves the immediate constraint, enabling full support for existing use cases, but also provides an extra bit for future expansion, ensuring compatibility with evolving operating system requirements.
Proof-of-Concept and Tests
The QEMU ISA emulator will be extended to support Svrsw60t59b
Linux kernel extended to use the additional reserved for software bits to simultaneously enable the following Linux kernel features that depend on these bits:
devmap
soft-dirty
uffd-wp
Software Ecosystem Impacts
Benefits the Linux kernel by allow enabling of the following features simultaneously in the kernel:
devmap
soft-dirty
uffd-wp
This enables usages such as VM live-migration and checkpoint creation/restore (CRIU) to be supported by the RISC-V Linux kernel.
Freeze Checklists
Select one of the options below (ISA or NON-ISA) and complete the table with the required information.
Key Milestones
To define you plan milestone dates, please use the https://tech.riscv.org/plan/.
Milestone | Date |
---|---|
Plan Approval | May 20, 2025 |
Internal Review Start | Aug 30, 2025 |
ARC Review Freeze Request | Nov 13, 2025 |
Freeze | Dec 6, 2025 |
Public Review Start | Dec 20, 2025 |
TSC Ratification Approval | Feb 4, 2026 |
BoD Ratification Approval | Feb 18, 2026 |
References
[1] FreeBSD
https://github.com/freebsd/freebsd-src/blob/d71e7e57fc1472e3ea6d31c44e187c2819d2c71e/sys/amd64/include/pmap.h#L73
https://github.com/freebsd/freebsd-src/blob/d71e7e57fc1472e3ea6d31c44e187c2819d2c71e/sys/riscv/include/pte.h#L70
[2] Linux
https://elixir.bootlin.com/linux/v6.13.3/source/arch/arm64/include/asm/pgtable-prot.h#L17
https://elixir.bootlin.com/linux/v6.13.3/source/arch/riscv/include/asm/pgtable-bits.h#L21
https://elixir.bootlin.com/linux/v6.13.3/source/arch/x86/include/asm/pgtable_types.h#L32
[3] Windows
https://wumb0.in/windows-10-kvas-and-software-smep.html
[4] Linux kernel features using RSW bits
https://lore.kernel.org/linux-riscv/20241113095833.1805746-1-zhangchunyan@iscas.ac.cn/
Related content
RISC-V International