Date: Mon, 14 Jun 2021 20:25:22 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e58cb5c01de9 - stable/13 - arm64: Use the right PTE when downgrading perms in pmap_promote_l2() Message-ID: <202106142025.15EKPMNd073165@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e58cb5c01de989c8f88af3732a5fe404b0660a9c commit e58cb5c01de989c8f88af3732a5fe404b0660a9c Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-06-06 20:40:29 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-06-14 20:25:14 +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 Sponsored by: The FreeBSD Foundation (cherry picked from commit a48f51b3d396664f9b0a91f016159f4e4324da85) --- 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 efe6bdd3d034..b49ec4194e19 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106142025.15EKPMNd073165>