Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154327026
D31162.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D31162.id.diff
View Options
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -7775,6 +7775,9 @@
continue;
if (srcptepaddr & PG_PS) {
+ /*
+ * We can only virtual copy whole superpages.
+ */
if ((addr & PDRMASK) != 0 || addr + NBPDR > end_addr)
continue;
pde = pmap_alloc_pde(dst_pmap, addr, &dst_pdpg, NULL);
@@ -7783,7 +7786,19 @@
if (*pde == 0 && ((srcptepaddr & PG_MANAGED) == 0 ||
pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr,
PMAP_ENTER_NORECLAIM, &lock))) {
- *pde = srcptepaddr & ~PG_W;
+ /*
+ * 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 &= ~PG_W;
+ if ((srcptepaddr & PG_MANAGED) != 0)
+ srcptepaddr &= ~PG_A;
+ *pde = srcptepaddr;
pmap_resident_count_adj(dst_pmap, NBPDR /
PAGE_SIZE);
counter_u64_add(pmap_pde_mappings, 1);
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -4557,6 +4557,9 @@
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 @@
((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);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 28, 9:03 PM (18 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32305558
Default Alt Text
D31162.id.diff (2 KB)
Attached To
Mode
D31162: pmap_copy: Clear the accessed bit when copying a managed superpage mapping
Attached
Detach File
Event Timeline
Log In to Comment