Skip to contentSkip to conversation

Page Table A&D bits scheme

DISCUSSION Theo Z 3 participants 3 messages Jan 5, 2024 RISC-V

lore
Share & tools
lore

Theo Z

author
#0 lore raw

According to Privileged: 4.3.1 (p81)

"Two schemes to manage the A and D bits are permitted:"

* When a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, a page-fault exception is raised.

* When a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, the implementation sets the corresponding bit(s) in the PTE

Which implementation does Linux is expected to work best with?

(Unix kernel xv6 works with 2nd scheme only)

Best regards,

Theo Z

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#1 lore raw

Hi Theo,

Quoted 6 lines · Theo Z

According to Privileged: 4.3.1 (p81)

"Two schemes to manage the A and D bits are permitted:"

* When a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, a page-fault exception is raised.

At the moment, this is the only scheme that the kernel supports.

Quoted 3 lines

* When a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, the implementation sets the corresponding bit(s) in the PTE

This will be supported by the kernel when svadu support is merged in the kernel (https://lore.kernel.org/linux-riscv/[email protected]/) and in openSBI (https://lists.infradead.org/pipermail/opensbi/2023-October/005768.html), but it depends on openSBI FWFT extension.

Quoted 3 lines

Which implementation does Linux is expected to work best with?

svadu will avoid a page fault so this will be the most performant implementation.

Quoted 6 lines

(Unix kernel xv6 works with 2nd scheme only)

Best regards,

Theo Z

Thanks,

Alex

Quoted 5 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#2 lore raw
Quoted 5 lines · Alexandre Ghiti

Hi Theo,

Quoted 2 lines · Theo Z

According to Privileged: 4.3.1 (p81)

Quoted 8 lines
Quoted 5 lines

"Two schemes to manage the A and D bits are permitted:"

* When a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, a
page-fault exception is raised.

At the moment, this is the only scheme that the kernel supports.

All versions of QEMU prior to 8.0.0 (released April 2023) implement the second scheme exclusively, setting the A and D bits in PTEs automatically, with no means for software to override. Any kernel version which runs on both pre-8.0.0 QEMU and hardware supports both schemes.

Support for RVA20 and later profiles requires scheme 1 to be in use at boot; Svadu (as discussed) provides an RVA20-compatible opt-in for scheme 2, and is supported by QEMU 8.0.0.

-s

Quoted 41 lines
Quoted 4 lines

* When a virtual page is accessed and the A bit is clear, or is written and the D bit is clear, the
implementation sets the corresponding bit(s) in the PTE

This will be supported by the kernel when svadu support is merged in the
kernel
(https://lore.kernel.org/linux-riscv/[email protected]/)
and in openSBI
(https://lists.infradead.org/pipermail/opensbi/2023-October/005768.html),
but it depends on openSBI FWFT extension.

Quoted 3 lines

Which implementation does Linux is expected to work best with?

svadu will avoid a page fault so this will be the most performant implementation.

Quoted 6 lines

(Unix kernel xv6 works with 2nd scheme only)

Best regards,

Theo Z

Thanks,

Alex

Quoted 5 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Quoted 4 lines

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv