HomeFreeBSD

riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2()

Description

riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2()

pmap_promote_l2() failed to handle implementations which set the
accessed and dirty flags. In particular, when comparing the attributes
of a run of 512 PTEs, we must handle the possibility that the hardware
will set PTE_D on a clean, writable mapping.

Following the example of amd64 and arm64, change riscv's
pmap_promote_l2() to downgrade clean, writable mappings to read-only, so
that updates are synchronized by the pmap lock.

Fixes: f6893f09d
Reported by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Tested by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
Reviewed by: jrtc27, alc, Nathaniel Filardo
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30644

Details

Provenance
markjAuthored on Jun 6 2021, 8:41 PM
Reviewer
jrtc27
Differential Revision
D30644: riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2()
Parents
rG4e4035ef1fb5: arm64: Fix pmap_copy()'s handling of 2MB mappings
Branches
Unknown
Tags
Unknown