Page MenuHomeFreeBSD

D51431.id158794.diff
No OneTemporary

D51431.id158794.diff

Index: sys/amd64/amd64/pmap.c
===================================================================
--- sys/amd64/amd64/pmap.c
+++ sys/amd64/amd64/pmap.c
@@ -6093,17 +6093,18 @@
if (mpte == NULL) {
/*
* Invalidate the 2MB page mapping and return "failure" if the
- * mapping was never accessed.
+ * mapping was never accessed and not wired.
*/
if ((oldpde & PG_A) == 0) {
- KASSERT((oldpde & PG_W) == 0,
- ("pmap_demote_pde: a wired mapping is missing PG_A"));
- pmap_demote_pde_abort(pmap, va, pde, oldpde, lockp);
- return (false);
- }
-
- mpte = pmap_remove_pt_page(pmap, va);
- if (mpte == NULL) {
+ if ((oldpde & PG_W) == 0) {
+ pmap_demote_pde_abort(pmap, va, pde, oldpde,
+ lockp);
+ return (false);
+ }
+ mpte = pmap_remove_pt_page(pmap, va);
+ /* Fill the PTP with PTEs that have PG_A cleared. */
+ mpte->valid = 0;
+ } else if ((mpte = pmap_remove_pt_page(pmap, va)) == NULL) {
KASSERT((oldpde & PG_W) == 0,
("pmap_demote_pde: page table page for a wired mapping is missing"));
@@ -6155,7 +6156,7 @@
/*
* If the PTP is not leftover from an earlier promotion or it does not
* have PG_A set in every PTE, then fill it. The new PTEs will all
- * have PG_A set.
+ * have PG_A set, unless this is a wired mapping with PG_A clear.
*/
if (!vm_page_all_valid(mpte))
pmap_fill_ptp(firstpte, newpte);
Index: sys/arm64/arm64/pmap.c
===================================================================
--- sys/arm64/arm64/pmap.c
+++ sys/arm64/arm64/pmap.c
@@ -8501,18 +8501,20 @@
/*
* Invalidate the 2MB page mapping and return "failure" if the
- * mapping was never accessed.
+ * mapping was never accessed and not wired.
*/
if ((oldl2 & ATTR_AF) == 0) {
- KASSERT((oldl2 & ATTR_SW_WIRED) == 0,
- ("pmap_demote_l2: a wired mapping is missing ATTR_AF"));
- pmap_demote_l2_abort(pmap, va, l2, lockp);
- CTR2(KTR_PMAP, "pmap_demote_l2: failure for va %#lx in pmap %p",
- va, pmap);
- goto fail;
- }
-
- if ((ml3 = pmap_remove_pt_page(pmap, va)) == NULL) {
+ if ((oldl2 & ATTR_SW_WIRED) == 0) {
+ pmap_demote_l2_abort(pmap, va, l2, lockp);
+ CTR2(KTR_PMAP,
+ "pmap_demote_l2: failure for va %#lx in pmap %p",
+ va, pmap);
+ goto fail;
+ }
+ ml3 = pmap_remove_pt_page(pmap, va);
+ /* Fill the PTP with L3Es that have ATTR_AF cleared. */
+ ml3->valid = 0;
+ } else if ((ml3 = pmap_remove_pt_page(pmap, va)) == NULL) {
KASSERT((oldl2 & ATTR_SW_WIRED) == 0,
("pmap_demote_l2: page table page for a wired mapping"
" is missing"));
@@ -8568,7 +8570,7 @@
/*
* If the PTP is not leftover from an earlier promotion or it does not
* have ATTR_AF set in every L3E, then fill it. The new L3Es will all
- * have ATTR_AF set.
+ * have ATTR_AF set, unless this is a wired mapping with ATTR_AF clear.
*
* When pmap_update_entry() clears the old L2 mapping, it (indirectly)
* performs a dsb(). That dsb() ensures that the stores for filling

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 30, 8:15 AM (21 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32476792
Default Alt Text
D51431.id158794.diff (2 KB)

Event Timeline