> the uvm_km_pgremove_intrsafe function requires pages to be mapped to free them > however it is then expected to call pmap_kremove(). This is > scary as in the page is freed, but is still mapped. > > Have uvm_km_pgremove_intrsafe() unmap as well as free.
Well then it makes sense to move the pmap_update() calls in there, too. > > Index: uvm/uvm_glue.c > =================================================================== > RCS file: /cvs/src/sys/uvm/uvm_glue.c,v > retrieving revision 1.56 > diff -u -p -r1.56 uvm_glue.c > --- uvm/uvm_glue.c 1 Apr 2011 15:43:13 -0000 1.56 > +++ uvm/uvm_glue.c 1 Apr 2011 18:08:52 -0000 > @@ -260,7 +260,6 @@ uvm_vslock_device(struct proc *p, void * > return 0; > > uvm_km_pgremove_intrsafe(sva, sva + sz); > - pmap_kremove(sva, sz); > pmap_update(pmap_kernel()); > out_unmap: > uvm_km_free(kernel_map, sva, sz); > @@ -291,7 +290,6 @@ uvm_vsunlock_device(struct proc *p, void > > kva = trunc_page((vaddr_t)map); > uvm_km_pgremove_intrsafe(kva, kva + sz); > - pmap_kremove(kva, sz); > pmap_update(pmap_kernel()); > uvm_km_free(kernel_map, kva, sz); > } > Index: uvm/uvm_km.c > =================================================================== > RCS file: /cvs/src/sys/uvm/uvm_km.c,v > retrieving revision 1.86 > diff -u -p -r1.86 uvm_km.c > --- uvm/uvm_km.c 26 Aug 2010 16:08:24 -0000 1.86 > +++ uvm/uvm_km.c 1 Apr 2011 18:25:51 -0000 > @@ -326,6 +326,7 @@ uvm_km_pgremove_intrsafe(vaddr_t start, > pg = PHYS_TO_VM_PAGE(pa); > if (pg == NULL) > panic("uvm_km_pgremove_intrsafe: no page"); > + pmap_kremove(va, PAGE_SIZE); > uvm_pagefree(pg); > } > } > Index: uvm/uvm_map.c > =================================================================== > RCS file: /cvs/src/sys/uvm/uvm_map.c,v > retrieving revision 1.131 > diff -u -p -r1.131 uvm_map.c > --- uvm/uvm_map.c 24 Dec 2010 21:49:04 -0000 1.131 > +++ uvm/uvm_map.c 1 Apr 2011 18:11:38 -0000 > @@ -1639,7 +1639,6 @@ uvm_unmap_remove(struct vm_map *map, vad > } > } else if (map->flags & VM_MAP_INTRSAFE) { > uvm_km_pgremove_intrsafe(entry->start, entry->end); > - pmap_kremove(entry->start, len); > } else if (UVM_ET_ISOBJ(entry) && > UVM_OBJ_IS_KERN_OBJECT(entry->object.uvm_obj)) { > KASSERT(vm_map_pmap(map) == pmap_kernel()); > > Dale Rahn dr...@dalerahn.com