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
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c05748e028b84c216d0161e70418f8cb09e074e4)

Details

Provenance
markjAuthored on Jun 6 2021, 8:41 PM
Parents
rG5346c8bc543a: Suppress D_NEEDGIANT warnings for some drivers
Branches
Unknown
Tags
Unknown