UMA allocations from a specific physical range

Nathan Whitehorn nwhitehorn at
Mon Sep 6 02:38:21 UTC 2010

PowerPC hypervisors typically provided a restricted range on memory when
the MMU is disabled, as it is when initially handling exceptions. In
order to restore virtual memory, the powerpc64 code needs to read a data
structure called the SLB cache, which is currently allocated out of a
UMA zone, and must be mapped into wired memory, ideally 1:1
physical->virtual address. Since this must be accessible in real mode,
it must have a physical address in a certain range. I am trying to
figure out the best way to do this.

My first run at this code uses a custom UMA allocator that calls
vm_phys_alloc_contig() to get a memory page. The trouble I have run into
is that I cannot figure out a way to free the page. Marking the zone
NOFREE is a bad solution, vm_page_free() panics the kernel due to
inconsistent tracking of page wiring, and vm_phys_free_pages() causes
panics in vm_page_alloc() later on ("page is not free"). What is the
correct way to deallocate these pages? Or is there a different approach
I should adopt?

More information about the freebsd-hackers mailing list