The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a48f51b3d396664f9b0a91f016159f4e4324da85
commit a48f51b3d396664f9b0a91f016159f4e4324da85 Author: Mark Johnston <ma...@freebsd.org> AuthorDate: 2021-06-06 20:40:29 +0000 Commit: Mark Johnston <ma...@freebsd.org> CommitDate: 2021-06-06 20:44:46 +0000 arm64: Use the right PTE when downgrading perms in pmap_promote_l2() When promoting a run of small mappings to a superpage, we have to downgrade clean, writable mappings to read-only, to handle the possibility that the MMU will concurrently mark one of the mappings as dirty. The code which performed this operation for the first PTE in the run used the wrong PTE pointer. As a result, the comparison would always fail, aborting the promotion. This only occurs when promoting writable, clean mappings. Fixes: ca2cae0b4dd Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30642 --- sys/arm64/arm64/pmap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index bc5d228af5ad..c26c3d8fce17 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3518,7 +3518,11 @@ setl2: if ((newl2 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { - if (!atomic_fcmpset_64(l2, &newl2, newl2 & ~ATTR_SW_DBM)) + /* + * When the mapping is clean, i.e., ATTR_S1_AP_RO is set, + * ATTR_SW_DBM can be cleared without a TLB invalidation. + */ + if (!atomic_fcmpset_64(firstl3, &newl2, newl2 & ~ATTR_SW_DBM)) goto setl2; newl2 &= ~ATTR_SW_DBM; } @@ -3529,6 +3533,11 @@ setl2: setl3: if ((oldl3 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { + /* + * When the mapping is clean, i.e., ATTR_S1_AP_RO is + * set, ATTR_SW_DBM can be cleared without a TLB + * invalidation. + */ if (!atomic_fcmpset_64(l3, &oldl3, oldl3 & ~ATTR_SW_DBM)) goto setl3; _______________________________________________ dev-commits-src-main@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"