removing mappings of uvm objects or device pages
Taylor R Campbell <riastradh <at> NetBSD.org>
2014-07-23 00:12:34 GMT
How can I remove all virtual mappings of a range of a uvm object, or
all virtual mappings of a physical page that is a device page rather
than a physical RAM page?
- I can't uvm_unmap(vm_map, start, end) because I don't know every
vm_map into which this uvm object has been mapped and where,
although if I had a way to list weak references to vm_maps perhaps I
could keep books about this.
- I can't pmap_page_protect(vm_page, VM_PROT_NONE) because there is no
struct vm_page for the pages in question -- they're device pages,
not system RAM pages.
Background (with apologies for the length; this is a little tricky):
Graphics drivers involve buffers, represented by UVM objects, that can
be mapped into the GPU virtual address space or into one or more of
the various CPU address spaces. Sometimes the driver needs to free up
some GPU virtual address space, so it will choose an inactive buffer
to evict, say at V_gpu, and unmap the GPU page table entry for V_gpu.
If the buffer is not mapped into any CPU virtual address space, all is
well and good. But if it is mapped into a CPU virtual address space,
say at the virtual address V_cpu, it's a little tricky.
While shared between GPU and CPU virtual address spaces, graphics
buffers are backed by physical pages of system RAM, say at the
physical address P_ram. The GPU page table's entry for V_gpu points
at P_ram. But the buffer's fault handler for V_cpu doesn't map it to
P_ram -- it maps V_cpu to a special physical address P_aper in a