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)
Wed, May 8, 8:57 PM
Unknown Object (File)
Thu, Apr 25, 12:22 PM
Unknown Object (File)
Mar 13 2024, 7:21 AM
Unknown Object (File)
Mar 12 2024, 1:00 AM
Unknown Object (File)
Feb 29 2024, 8:47 PM
Unknown Object (File)
Jan 18 2024, 2:34 PM
Unknown Object (File)
Dec 20 2023, 2:45 AM
Unknown Object (File)
Dec 12 2023, 11:01 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

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

Event Timeline

This revision is now accepted and ready to land.Jul 24 2018, 5:30 PM
sys/i386/i386/pmap.c
665 ↗(On Diff #45790)

Oops, this change isn't needed.

sys/amd64/amd64/pmap.c
1339 ↗(On Diff #45790)

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
1339 ↗(On Diff #45790)

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

sys/amd64/amd64/pmap.c
983 ↗(On Diff #45826)

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?

1013 ↗(On Diff #45826)

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 ↗(On Diff #45826)

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.