From owner-freebsd-current@FreeBSD.ORG Sun Mar 10 03:02:24 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E5B932C6; Sun, 10 Mar 2013 03:02:24 +0000 (UTC) (envelope-from imb@protected-networks.net) Received: from sarah.protected-networks.net (sarah.protected-networks.net [IPv6:2001:470:1f07:4e1::1]) by mx1.freebsd.org (Postfix) with ESMTP id B68DB8EA; Sun, 10 Mar 2013 03:02:24 +0000 (UTC) Received: from toshi.auburn.protected-networks.net (toshi.auburn.protected-networks.net [202.12.127.84]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "Iain Butler", Issuer "RSA Class 2 Personal CA v2" (verified OK)) (Authenticated sender: imb@protected-networks.net) by sarah.protected-networks.net (Postfix) with ESMTPSA id D1BD36149; Sat, 9 Mar 2013 22:02:17 -0500 (EST) DomainKey-Signature: a=rsa-sha1; s=200509; d=protected-networks.net; c=nofws; q=dns; h=message-id:date:from:user-agent:mime-version:to:subject: references:in-reply-to:x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=TCtxvGVgXAAOv0j2odegi2skZI6aU1sSeyLsw7RegoSKVYeAT72tHjhE1R0Ca+eif AYhtwkvcB9jeUl21Ze09b70ebdc6KvahQCvdz4p9TT0y6nBsOIl7RhcI8kAKu5l Message-ID: <513BF7B8.9040901@protected-networks.net> Date: Sat, 09 Mar 2013 22:02:16 -0500 From: Michael Butler User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: emulation@FreeBSD.org, FreeBSD Current Subject: Re: VirtualBox driver patch for -current post SVN r248084 References: <513BF6D7.1010509@protected-networks.net> In-Reply-To: <513BF6D7.1010509@protected-networks.net> X-Enigmail-Version: 1.5.1 OpenPGP: id=0442D492 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 03:02:25 -0000 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 #include #include + #include #include #include /* for vtophys */ #include