Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109631040
D21491.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D21491.diff
View Options
Index: head/sys/amd64/amd64/pmap.c
===================================================================
--- head/sys/amd64/amd64/pmap.c
+++ head/sys/amd64/amd64/pmap.c
@@ -384,9 +384,6 @@
static u_int64_t DMPDPphys; /* phys addr of direct mapped level 3 */
static int ndmpdpphys; /* number of DMPDPphys pages */
-static uint64_t PAPDPphys; /* phys addr of page array level 3 */
-static int npapdpphys; /* number of PAPDPphys pages */
-
static vm_paddr_t KERNend; /* phys addr of end of bootstrap data */
/*
@@ -1431,16 +1428,6 @@
pml4_entry_t *p4_p;
uint64_t DMPDkernphys;
- npapdpphys = howmany(ptoa(Maxmem) / sizeof(struct vm_page), NBPML4);
- if (npapdpphys > NPAPML4E) {
- printf("NDMPML4E limits system to %lu GB\n",
- (NDMPML4E * 512) * (PAGE_SIZE / sizeof(struct vm_page)));
- npapdpphys = NPAPML4E;
- Maxmem = atop(NPAPML4E * NBPML4 *
- (PAGE_SIZE / sizeof(struct vm_page)));
- }
- PAPDPphys = allocpages(firstaddr, npapdpphys);
-
/* Allocate page table pages for the direct map */
ndmpdp = howmany(ptoa(Maxmem), NBPDP);
if (ndmpdp < 4) /* Minimum 4GB of dirmap */
@@ -1587,12 +1574,6 @@
p4_p[KPML4BASE + i] = KPDPphys + ptoa(i);
p4_p[KPML4BASE + i] |= X86_PG_RW | X86_PG_V;
}
-
- /* Connect the page array slots up to the pml4. */
- for (i = 0; i < npapdpphys; i++) {
- p4_p[PAPML4I + i] = PAPDPphys + ptoa(i);
- p4_p[PAPML4I + i] |= X86_PG_RW | X86_PG_V | pg_nx;
- }
}
/*
@@ -3456,11 +3437,6 @@
X86_PG_V;
}
- for (i = 0; i < npapdpphys; i++) {
- pm_pml4[PAPML4I + i] = (PAPDPphys + ptoa(i)) | X86_PG_RW |
- X86_PG_V;
- }
-
/* install self-referential address mapping entry(s) */
pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | X86_PG_V | X86_PG_RW |
X86_PG_A | X86_PG_M;
@@ -3817,8 +3793,6 @@
pmap->pm_pml4[KPML4BASE + i] = 0;
for (i = 0; i < ndmpdpphys; i++)/* Direct Map */
pmap->pm_pml4[DMPML4I + i] = 0;
- for (i = 0; i < npapdpphys; i++)
- pmap->pm_pml4[PAPML4I + i] = 0;
pmap->pm_pml4[PML4PML4I] = 0; /* Recursive Mapping */
for (i = 0; i < lm_ents; i++) /* Large Map */
pmap->pm_pml4[LMSPML4I + i] = 0;
@@ -3856,6 +3830,10 @@
SYSCTL_PROC(_vm, OID_AUTO, kvm_free, CTLTYPE_LONG|CTLFLAG_RD,
0, 0, kvm_free, "LU", "Amount of KVM free");
+/*
+ * Allocate physical memory for the vm_page array and map it into KVA,
+ * attempting to back the vm_pages with domain-local memory.
+ */
void
pmap_page_array_startup(long pages)
{
@@ -3868,14 +3846,15 @@
vm_page_array_size = pages;
- start = va = PA_MIN_ADDRESS;
- end = va + (pages * sizeof(struct vm_page));
+ start = va = VM_MIN_KERNEL_ADDRESS;
+ end = va + pages * sizeof(struct vm_page);
while (va < end) {
- pfn = first_page + ((va - start) / sizeof(struct vm_page));
+ pfn = first_page + (va - start) / sizeof(struct vm_page);
domain = _vm_phys_domain(ctob(pfn));
pdpe = pmap_pdpe(kernel_pmap, va);
if ((*pdpe & X86_PG_V) == 0) {
pa = vm_phys_early_alloc(domain, PAGE_SIZE);
+ dump_add_page(pa);
bzero((void *)PHYS_TO_DMAP(pa), PAGE_SIZE);
*pdpe = (pdp_entry_t)(pa | X86_PG_V | X86_PG_RW |
X86_PG_A | X86_PG_M);
@@ -3892,6 +3871,7 @@
pde_store(pde, newpdir);
va += NBPDR;
}
+ vm_page_array = (vm_page_t)start;
}
/*
Index: head/sys/amd64/include/vmparam.h
===================================================================
--- head/sys/amd64/include/vmparam.h
+++ head/sys/amd64/include/vmparam.h
@@ -160,13 +160,12 @@
* 0xffff808000000000 - 0xffff847fffffffff large map (can be tuned up)
* 0xffff848000000000 - 0xfffff7ffffffffff unused (large map extends there)
* 0xfffff80000000000 - 0xfffffbffffffffff 4TB direct map
- * 0xfffffc0000000000 - 0xfffffcffffffffff unused
- * 0xfffffd0000000000 - 0xfffffd7fffffffff page array 512GB
- * 0xfffffd8000000000 - 0xfffffdffffffffff unused
+ * 0xfffffc0000000000 - 0xfffffdffffffffff unused
* 0xfffffe0000000000 - 0xffffffffffffffff 2TB kernel map
*
* Within the kernel map:
*
+ * 0xfffffe0000000000 vm_page_array
* 0xffffffff80000000 KERNBASE
*/
@@ -216,10 +215,10 @@
(x) & ~DMAP_MIN_ADDRESS; })
/*
- * amd64 statically allocates the page array address so that it can
- * be more easily allocated on the correct memory domains.
+ * amd64 maps the page array into KVA so that it can be more easily
+ * allocated on the correct memory domains.
*/
-#define PMAP_HAS_PAGE_ARRAY 1
+#define PMAP_HAS_PAGE_ARRAY 1
/*
* How many physical pages per kmem arena virtual page.
Index: head/sys/vm/vm_kern.c
===================================================================
--- head/sys/vm/vm_kern.c
+++ head/sys/vm/vm_kern.c
@@ -759,7 +759,7 @@
vm_map_lock(m);
/* N.B.: cannot use kgdb to debug, starting with this assignment ... */
kernel_map = m;
- (void) vm_map_insert(m, NULL, (vm_ooffset_t) 0,
+ (void)vm_map_insert(m, NULL, 0,
#ifdef __amd64__
KERNBASE,
#else
@@ -767,6 +767,18 @@
#endif
start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
/* ... and ending with the completion of the above `insert' */
+
+#ifdef __amd64__
+ /*
+ * Mark KVA used for the page array as allocated. Other platforms
+ * that handle vm_page_array allocation can simply adjust virtual_avail
+ * instead.
+ */
+ (void)vm_map_insert(m, NULL, 0, (vm_offset_t)vm_page_array,
+ (vm_offset_t)vm_page_array + round_2mpage(vm_page_array_size *
+ sizeof(struct vm_page)),
+ VM_PROT_RW, VM_PROT_RW, MAP_NOFAULT);
+#endif
vm_map_unlock(m);
/*
Index: head/sys/vm/vm_page.c
===================================================================
--- head/sys/vm/vm_page.c
+++ head/sys/vm/vm_page.c
@@ -135,11 +135,7 @@
*/
vm_page_t bogus_page;
-#ifdef PMAP_HAS_PAGE_ARRAY
-vm_page_t vm_page_array = (vm_page_t)PA_MIN_ADDRESS;
-#else
vm_page_t vm_page_array;
-#endif
long vm_page_array_size;
long first_page;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 8, 5:40 PM (20 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16529765
Default Alt Text
D21491.diff (5 KB)
Attached To
Mode
D21491: Keep the vm_page array mapped into KVA on amd64.
Attached
Detach File
Event Timeline
Log In to Comment