Page MenuHomeFreeBSD

Keep the vm_page array mapped into KVA on amd64.
ClosedPublic

Authored by markj on Sep 2 2019, 6:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 27 2024, 11:45 AM
Unknown Object (File)
Jan 27 2024, 11:45 AM
Unknown Object (File)
Jan 27 2024, 11:45 AM
Unknown Object (File)
Dec 22 2023, 10:49 PM
Unknown Object (File)
Dec 11 2023, 5:54 AM
Unknown Object (File)
Nov 15 2023, 7:40 PM
Unknown Object (File)
Nov 11 2023, 3:47 PM
Unknown Object (File)
Nov 7 2023, 12:34 PM
Subscribers

Details

Summary

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, since the minidump code 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 on amd64. The main change is that we have to
remove the mapping from kernel_map in kmem_init().

Test Plan

I booted in a 1GB VM, a 2-socket system with 64GB of RAM, and pig1 (4 sockets
and 1TB of RAM), and verified that kgdb can access the page array.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 26237
Build 24729: arc lint + arc unit

Event Timeline

markj edited the test plan for this revision. (Show Details)
markj added reviewers: alc, kib, jeff, gallatin.
sys/amd64/amd64/pmap.c
3855

I think we can do better and use 1GB pages when possible, which is when we have domains with >= ~40GB.

sys/vm/vm_kern.c
776

The roundup is because pmap_page_array_startup() always uses 2MB pages, but of course the vm_page array might not be a multiple of 2MB in size. KVA_QUANTUM isn't really the right constant, but I'm not sure what else to use. VM_LEVEL_0_ORDER is not defined on some platforms which might use large pages to map the array, like powerpc.

Fix the !PMAP_HAS_PAGE_ARRAY build.

sys/amd64/include/vmparam.h
167–168

I think it worth noting where the vm_page_array is located.

sys/vm/vm_kern.c
771

Does ppc need this space reservation ? I suspect it is more correct to use ifdef amd64 there.

775

Extra space between ) and 0. That said, do you need to cast 0 ?

sys/vm/vm_kern.c
771

I think you're right, powerpc will adjust virtual_avail.

775

Blindly copied and pasted from above, will fix.

markj marked 3 inline comments as done.

Updates from kib's feedback.

Use round_2mpage() instead of rounding up to KVA_QUANTUM, now that
the kmem_init() change is amd64-only.

This revision is now accepted and ready to land.Sep 2 2019, 6:44 PM
This revision was automatically updated to reflect the committed changes.

I believe that PA_MIN_ADDRESS can be removed, as it was introduced by the original version of this code.

head/sys/amd64/amd64/pmap.c
3853 ↗(On Diff #61582)

ctob(pfn) -> ptoa(pfn)

ctob() is archaic, and never used in Mach-derived VM code. For example, it appears nowhere else in this file or under vm/ except in some stack growth code.

3858 ↗(On Diff #61582)

-> pagezero((void *)PHYS_TO_DMAP(pa));