From 9d75f0dc75033e8d99c6d9f9328702f4aef27179 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 3 Sep 2019 13:18:51 +0000 Subject: Map the vm_page array into KVA on amd64. r351198 allows the kernel to use domain-local memory to back the vm_page array (up to 2MB boundaries) and reserves a separate PML4 entry for that purpose. One consequence of that change is that the vm_page array is no longer present in minidumps, which only adds pages mapped above VM_MIN_KERNEL_ADDRESS. To avoid the friction caused by having kernel data structures mapped below VM_MIN_KERNEL_ADDRESS, map the vm_page array starting at VM_MIN_KERNEL_ADDRESS instead of using a dedicated PML4 entry. Reviewed by: kib Discussed with: jeff Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21491 --- sys/vm/vm_kern.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sys/vm/vm_kern.c') diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 324c9cce10f6..482ead0d1180 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -759,7 +759,7 @@ kmem_init(vm_offset_t start, vm_offset_t end) 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 @@ kmem_init(vm_offset_t start, vm_offset_t end) #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); /* -- cgit v1.2.3