diff options
author | Alan Cox <alc@FreeBSD.org> | 2021-07-13 07:30:43 +0000 |
---|---|---|
committer | Alan Cox <alc@FreeBSD.org> | 2021-07-14 18:06:10 +0000 |
commit | 325ff9327459bc7307130675fa19367ff8b02310 (patch) | |
tree | 75f9f988f86c864f9981b90b7f0bf97d14dfdda4 /sys/arm64/arm64 | |
parent | d379886a4170fa3d95a5354612a5e2c15b104841 (diff) | |
download | src-325ff9327459bc7307130675fa19367ff8b02310.tar.gz src-325ff9327459bc7307130675fa19367ff8b02310.zip |
Clear the accessed bit when copying a managed superpage mapping
pmap_copy() is used to speculatively create mappings, so those mappings
should not have their access bit preset.
Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31162
Diffstat (limited to 'sys/arm64/arm64')
-rw-r--r-- | sys/arm64/arm64/pmap.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 8ed1b86bd58c..678feae55c25 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4557,6 +4557,9 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, if (srcptepaddr == 0) continue; if ((srcptepaddr & ATTR_DESCR_MASK) == L2_BLOCK) { + /* + * We can only virtual copy whole superpages. + */ if ((addr & L2_OFFSET) != 0 || addr + L2_SIZE > end_addr) continue; @@ -4567,8 +4570,19 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, ((srcptepaddr & ATTR_SW_MANAGED) == 0 || pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - mask = ATTR_SW_WIRED; - pmap_store(l2, srcptepaddr & ~mask); + /* + * We leave the dirty bit unchanged because + * managed read/write superpage mappings are + * required to be dirty. However, managed + * superpage mappings are not required to + * have their accessed bit set, so we clear + * it because we don't know if this mapping + * will be used. + */ + srcptepaddr &= ~ATTR_SW_WIRED; + if ((srcptepaddr & ATTR_SW_MANAGED) != 0) + srcptepaddr &= ~ATTR_AF; + pmap_store(l2, srcptepaddr); pmap_resident_count_inc(dst_pmap, L2_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l2_mappings, 1); |