]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2()
authorMark Johnston <markj@FreeBSD.org>
Sun, 6 Jun 2021 20:41:35 +0000 (16:41 -0400)
committerMark Johnston <markj@FreeBSD.org>
Sun, 6 Jun 2021 20:44:46 +0000 (16:44 -0400)
commitc05748e028b84c216d0161e70418f8cb09e074e4
tree2716b7533990de492520d6521939aaa582f97c3d
parent4e4035ef1fb5e2f9da6b658ffae8a54862b4d018
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
sys/riscv/riscv/pmap.c