Date: Sat, 09 Mar 2013 22:02:16 -0500 From: Michael Butler <imb@protected-networks.net> To: emulation@FreeBSD.org, FreeBSD Current <freebsd-current@FreeBSD.org> Subject: Re: VirtualBox driver patch for -current post SVN r248084 Message-ID: <513BF7B8.9040901@protected-networks.net> In-Reply-To: <513BF6D7.1010509@protected-networks.net> References: <513BF6D7.1010509@protected-networks.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 03/09/13 21:58, Michael Butler wrote: > With the changing of the vm_object mutex to a rwlock, the VirtualBox > drivers (emulators/virtualbox-ose-kmod) need the attached patch to run, > > imb *** src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c~ Sat Mar 9 21:15:12 2013 --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c Sat Mar 9 21:21:20 2013 *************** *** 162,168 **** case RTR0MEMOBJTYPE_PHYS: case RTR0MEMOBJTYPE_PHYS_NC: { ! VM_OBJECT_LOCK(pMemFreeBSD->pObject); vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); #if __FreeBSD_version < 900000 /* See http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html */ --- 162,168 ---- case RTR0MEMOBJTYPE_PHYS: case RTR0MEMOBJTYPE_PHYS_NC: { ! VM_OBJECT_WLOCK(pMemFreeBSD->pObject); vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); #if __FreeBSD_version < 900000 /* See http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html */ *************** *** 177,183 **** #if __FreeBSD_version < 900000 vm_page_unlock_queues(); #endif ! VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); vm_object_deallocate(pMemFreeBSD->pObject); break; } --- 177,183 ---- #if __FreeBSD_version < 900000 vm_page_unlock_queues(); #endif ! VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); vm_object_deallocate(pMemFreeBSD->pObject); break; } *************** *** 205,214 **** while (cTries <= 1) { ! VM_OBJECT_LOCK(pObject); pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); ! VM_OBJECT_UNLOCK(pObject); if (pPages) break; vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh); --- 205,214 ---- while (cTries <= 1) { ! VM_OBJECT_WLOCK(pObject); pPages = vm_page_alloc_contig(pObject, iPIndex, fFlags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); ! VM_OBJECT_WUNLOCK(pObject); if (pPages) break; vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh); *************** *** 228,234 **** if (!pPages) return pPages; ! VM_OBJECT_LOCK(pObject); for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) { vm_page_t pPage = pPages + iPage; --- 228,234 ---- if (!pPages) return pPages; ! VM_OBJECT_WLOCK(pObject); for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) { vm_page_t pPage = pPages + iPage; *************** *** 240,246 **** atomic_add_int(&cnt.v_wire_count, 1); } } ! VM_OBJECT_UNLOCK(pObject); return pPages; #endif } --- 240,246 ---- atomic_add_int(&cnt.v_wire_count, 1); } } ! VM_OBJECT_WUNLOCK(pObject); return pPages; #endif } *************** *** 264,270 **** if (!pPage) { /* Free all allocated pages */ ! VM_OBJECT_LOCK(pObject); while (iPage-- > 0) { pPage = vm_page_lookup(pObject, iPage); --- 264,270 ---- if (!pPage) { /* Free all allocated pages */ ! VM_OBJECT_WLOCK(pObject); while (iPage-- > 0) { pPage = vm_page_lookup(pObject, iPage); *************** *** 278,284 **** vm_page_unlock_queues(); #endif } ! VM_OBJECT_UNLOCK(pObject); return rcNoMem; } } --- 278,284 ---- vm_page_unlock_queues(); #endif } ! VM_OBJECT_WUNLOCK(pObject); return rcNoMem; } } *************** *** 411,419 **** if (fContiguous) { Assert(enmType == RTR0MEMOBJTYPE_PHYS); ! VM_OBJECT_LOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0)); ! VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.fAllocated = true; } --- 411,419 ---- if (fContiguous) { Assert(enmType == RTR0MEMOBJTYPE_PHYS); ! VM_OBJECT_WLOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0)); ! VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.fAllocated = true; } *************** *** 823,831 **** case RTR0MEMOBJTYPE_PHYS_NC: { RTHCPHYS addr; ! VM_OBJECT_LOCK(pMemFreeBSD->pObject); addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); ! VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); return addr; } --- 823,831 ---- case RTR0MEMOBJTYPE_PHYS_NC: { RTHCPHYS addr; ! VM_OBJECT_WLOCK(pMemFreeBSD->pObject); addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); ! VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject); return addr; } *** src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h~ Wed Dec 19 13:27:29 2012 --- src/VBox/Runtime/r0drv/freebsd/the-freebsd-kernel.h Sat Mar 9 21:37:09 2013 *************** *** 57,62 **** --- 57,63 ---- #include <sys/smp.h> #include <sys/sleepqueue.h> #include <sys/sx.h> + #include <sys/rwlock.h> #include <vm/vm.h> #include <vm/pmap.h> /* for vtophys */ #include <vm/vm_map.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?513BF7B8.9040901>