Page MenuHomeFreeBSD

Fix KVA handling in kmem_bootstrap_free().
ClosedPublic

Authored by markj on Jul 24 2018, 5:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 29, 11:18 AM
Unknown Object (File)
Oct 22 2024, 12:35 AM
Unknown Object (File)
Sep 28 2024, 5:59 PM
Unknown Object (File)
Sep 17 2024, 9:18 AM
Unknown Object (File)
Sep 15 2024, 3:46 AM
Unknown Object (File)
Sep 14 2024, 9:23 AM
Unknown Object (File)
Sep 11 2024, 12:27 PM
Unknown Object (File)
Sep 5 2024, 7:02 AM
Subscribers

Details

Summary

The kmem_* layer must handle pmap updates itself, since vm_map_remove()
won't update the kernel pmap for us. Thus, modify kmem_bootstrap_free()
to remove the KVA range from kernel_pmap and add it to kernel_arena.
For this to work, we must support demotion of the bootstrapped kernel
page tables. It suffices to ensure that PG_A is set on the PDEs (i386
already does this) and to insert the shadowed PTPs into the kernel
pmap's radix tree when initializing them in pmap_init().

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18334
Build 18055: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Jul 24 2018, 5:30 PM
sys/i386/i386/pmap.c
665

Oops, this change isn't needed.

sys/amd64/amd64/pmap.c
1340

KERNend could be in the midst of a 2 MB page mapping. Are you sure that you want to use trunc here?

markj marked 2 inline comments as done.
  • Don't set PG_A on PTEs.
  • Fix test in pmap_init() on amd64.
This revision now requires review to proceed.Jul 25 2018, 3:17 PM
sys/amd64/amd64/pmap.c
1340

Indeed, this doesn't match the loop in create_pagetables() which creates the 2MB mappings of the kernel.

sys/amd64/amd64/pmap.c
983

Is there a reason for placing this assignment here? At this point, create_pagetables() has allocated some, but not all, of the pages that it's going to allocate. Why not do this assignment in pmap_bootstrap(), before create_pagetables() is called?

1012

As an aside, I wish there was a way to easily use the up to 1.99... MB of memory that we are wasting here as UMA boot pages.

sys/i386/i386/pmap.c
941–946

While we are here, can you please merge r329171 from amd64.

markj marked 2 inline comments as done.
  • Move the initialization of KERNend on amd64.
  • Wire kernel PTPs on i386.
This revision is now accepted and ready to land.Jul 26 2018, 9:54 PM
This revision was automatically updated to reflect the committed changes.