Page MenuHomeFreeBSD

i386: Merge PAE and non-PAE pmaps into same kernel.
ClosedPublic

Authored by kib on Jan 18 2019, 6:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 10, 12:23 AM
Unknown Object (File)
Mon, Apr 8, 8:05 AM
Unknown Object (File)
Mon, Apr 1, 1:48 AM
Unknown Object (File)
Mon, Apr 1, 1:48 AM
Unknown Object (File)
Mon, Apr 1, 1:48 AM
Unknown Object (File)
Mon, Apr 1, 1:48 AM
Unknown Object (File)
Sat, Mar 30, 6:57 PM
Unknown Object (File)
Feb 3 2024, 9:15 AM
Subscribers

Details

Summary

Effectively all i386 kernels now have two pmaps compiled in: one managing PAE pagetables, and another non-PAE. The implementation is selected at cold time depending on the CPU features. The vm_paddr_t is always 64bit now. As result, nx bit can be used on all capable CPUs.

Option PAE only affects the bus_addr_t: it is still 32bit for non-PAE configs, for drivers compatibility. Kernel layout, esp. max kernel address, low memory PDEs and max user address (same as trampoline start) are now same for PAE and for non-PAE regardless of the type of page tables used.

Non-PAE kernel (when using PAE pagetables) can handle physical memory up to 24G now, larger memory requires re-tuning the KVA consumers and instead the code caps the maximum at 24G. Unfortunately, a lot of drivers do not use busdma(9) properly so by default even 4G barrier is not easy. There are two tunables added: hw.above4g_allow and hw.above24g_allow, the first one might be worth to try, second is only for dev use.

i386 now creates three freelists if there is any memory above 4G, to allow proper bounce pages allocation. Also, VM_KMEM_SIZE_SCALE changed from 3 to 1.

Tested by: pho

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
sys/i386/i386/pmap.c
1383 ↗(On Diff #52999)

Of the pmap_invalidate_* functions, only pmap_invalidate_page() needs to be externally visible. Rather than turning them into methods (which pessimizes internal callers), it might be better to define a different entry point for use by the vm86 layer.

2015 ↗(On Diff #52999)

While here, maybe convert this to VM_ALLOC_WAITOK.

sys/i386/i386/pmap_nopae.c
1 ↗(On Diff #52999)

Usually there is some "This file is in the public domain" note for trivial files.

This revision is now accepted and ready to land.Jan 28 2019, 8:32 PM
kib marked 3 inline comments as done.Jan 28 2019, 9:13 PM
kib added inline comments.
sys/i386/i386/pmap.c
1383 ↗(On Diff #52999)

I did it slightly different since I want all old pmap interfaces to be there after the merge, regardless of actual use.

I renamed actual implementations of pmap_invalidate_XXX to pmap_invalidate_XXX_int() and the virtual method calls the _int() variant.

sys/i386/i386/pmap_nopae.c
1 ↗(On Diff #52999)

It is not that trivial. I just forgot to add the copyright, thanks for noting.

kib marked 2 inline comments as done.

Add copyrights.
Use VM_ALLOC_WAITOK.
Remove unneeded use of vtable for pmap_invalidate.

This revision now requires review to proceed.Jan 28 2019, 10:36 PM
This revision is now accepted and ready to land.Jan 28 2019, 11:20 PM
This revision was automatically updated to reflect the committed changes.