From owner-svn-src-all@freebsd.org Tue Jul 16 14:40:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 350B6B10F3; Tue, 16 Jul 2019 14:40:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 183B98776E; Tue, 16 Jul 2019 14:40:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D05467505; Tue, 16 Jul 2019 14:40:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x6GEenNK065323; Tue, 16 Jul 2019 14:40:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x6GEenHI065322; Tue, 16 Jul 2019 14:40:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201907161440.x6GEenHI065322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 16 Jul 2019 14:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r350029 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 350029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 183B98776E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.93)[-0.934,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jul 2019 14:40:50 -0000 Author: markj Date: Tue Jul 16 14:40:49 2019 New Revision: 350029 URL: https://svnweb.freebsd.org/changeset/base/350029 Log: Propagate attribute changes during demotion. After r349117 and r349122, some mapping attribute changes do not trigger superpage demotion. However, pmap_demote_l2() was not updated to ensure that the replacement L3 entries carry any attribute changes that occurred since promotion. Reported and tested by: manu Reviewed by: alc MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20965 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Tue Jul 16 12:57:59 2019 (r350028) +++ head/sys/arm64/arm64/pmap.c Tue Jul 16 14:40:49 2019 (r350029) @@ -5310,6 +5310,17 @@ pmap_demote_l1(pmap_t pmap, pt_entry_t *l1, vm_offset_ } static void +pmap_fill_l3(pt_entry_t *firstl3, pt_entry_t newl3) +{ + pt_entry_t *l3; + + for (l3 = firstl3; l3 - firstl3 < Ln_ENTRIES; l3++) { + *l3 = newl3; + newl3 += L3_SIZE; + } +} + +static void pmap_demote_l2_abort(pmap_t pmap, vm_offset_t va, pt_entry_t *l2, struct rwlock **lockp) { @@ -5330,9 +5341,8 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ { pt_entry_t *l3, newl3, oldl2; vm_offset_t tmpl2; - vm_paddr_t l3phys, phys; + vm_paddr_t l3phys; vm_page_t ml3; - int i; PMAP_LOCK_ASSERT(pmap, MA_OWNED); l3 = NULL; @@ -5406,27 +5416,17 @@ pmap_demote_l2_locked(pmap_t pmap, pt_entry_t *l2, vm_ } l3phys = VM_PAGE_TO_PHYS(ml3); l3 = (pt_entry_t *)PHYS_TO_DMAP(l3phys); - /* Address the range points at */ - phys = oldl2 & ~ATTR_MASK; - /* The attributed from the old l2 table to be copied */ - newl3 = (oldl2 & (ATTR_MASK & ~ATTR_DESCR_MASK)) | L3_PAGE; + newl3 = (oldl2 & ~ATTR_DESCR_MASK) | L3_PAGE; KASSERT((oldl2 & (ATTR_AP_RW_BIT | ATTR_SW_DBM)) != (ATTR_AP(ATTR_AP_RO) | ATTR_SW_DBM), ("pmap_demote_l2: L2 entry is writeable but not dirty")); /* * If the page table page is not leftover from an earlier promotion, - * initialize it. + * or the mapping attributes have changed, (re)initialize the L3 table. */ - if (ml3->valid == 0) { - for (i = 0; i < Ln_ENTRIES; i++) { - l3[i] = newl3 | phys; - phys += L3_SIZE; - } - } - KASSERT(l3[0] == ((oldl2 & ~ATTR_DESCR_MASK) | L3_PAGE), - ("Invalid l3 page (%lx != %lx)", l3[0], - (oldl2 & ~ATTR_DESCR_MASK) | L3_PAGE)); + if (ml3->valid == 0 || (l3[0] & ATTR_MASK) != (newl3 & ATTR_MASK)) + pmap_fill_l3(l3, newl3); /* * Map the temporary page so we don't lose access to the l2 table.