Fix panic for stable/9. Use vm_page_alloc_contig() as it is now available.

Tested by:	Douglas Berry (doug at bitnix dot ca)
PR:		ports/187580
This commit is contained in:
Jung-uk Kim 2014-03-20 18:11:11 +00:00
parent 76c175fb69
commit bb54ae20b3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=348711
6 changed files with 127 additions and 36 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= virtualbox-ose
DISTVERSION= 4.3.8
PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \

View file

@ -3,6 +3,7 @@
PORTNAME= virtualbox-ose
DISTVERSION= 4.2.22
PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \

View file

@ -1,7 +1,7 @@
$FreeBSD$
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:19:36.795745576 -0700
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-03-20 19:15:35.164791970 -0700
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2014-03-14 17:25:46.000000000 -0400
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2014-03-14 17:34:35.000000000 -0400
@@ -162,7 +162,11 @@
case RTR0MEMOBJTYPE_PHYS:
case RTR0MEMOBJTYPE_PHYS_NC:
@ -14,7 +14,7 @@ $FreeBSD$
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,7 +181,12 @@
@@ -177,7 +181,11 @@
#if __FreeBSD_version < 900000
vm_page_unlock_queues();
#endif
@ -23,11 +23,18 @@ $FreeBSD$
+#else
VM_OBJECT_UNLOCK(pMemFreeBSD->pObject);
+#endif
+
vm_object_deallocate(pMemFreeBSD->pObject);
break;
}
@@ -205,10 +214,18 @@
@@ -198,17 +206,25 @@
vm_page_t pPages;
int cTries = 0;
-#if __FreeBSD_version > 1000000
+#if __FreeBSD_version >= 902508
int fFlags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY;
if (fWire)
fFlags |= VM_ALLOC_WIRED;
while (cTries <= 1)
{
@ -46,31 +53,7 @@ $FreeBSD$
if (pPages)
break;
vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh);
@@ -228,7 +245,11 @@
if (!pPages)
return pPages;
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_WLOCK(pObject);
+#else
VM_OBJECT_LOCK(pObject);
+#endif
for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
{
vm_page_t pPage = pPages + iPage;
@@ -240,7 +261,11 @@
atomic_add_int(&cnt.v_wire_count, 1);
}
}
+#if __FreeBSD_version >= 1000030
+ VM_OBJECT_WUNLOCK(pObject);
+#else
VM_OBJECT_UNLOCK(pObject);
+#endif
return pPages;
#endif
}
@@ -264,7 +289,11 @@
@@ -264,7 +280,11 @@
if (!pPage)
{
/* Free all allocated pages */
@ -82,7 +65,7 @@ $FreeBSD$
while (iPage-- > 0)
{
pPage = vm_page_lookup(pObject, iPage);
@@ -278,7 +307,11 @@
@@ -278,7 +298,11 @@
vm_page_unlock_queues();
#endif
}
@ -94,7 +77,7 @@ $FreeBSD$
return rcNoMem;
}
}
@@ -411,9 +444,17 @@
@@ -417,9 +441,17 @@
if (fContiguous)
{
Assert(enmType == RTR0MEMOBJTYPE_PHYS);
@ -112,7 +95,7 @@ $FreeBSD$
pMemFreeBSD->Core.u.Phys.fAllocated = true;
}
@@ -823,9 +864,17 @@
@@ -838,9 +870,17 @@
case RTR0MEMOBJTYPE_PHYS_NC:
{
RTHCPHYS addr;

View file

@ -0,0 +1,37 @@
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2014-03-17 14:08:04.000000000 -0400
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2014-03-17 14:09:34.000000000 -0400
@@ -211,7 +211,7 @@
if (fWire)
fFlags |= VM_ALLOC_WIRED;
- while (cTries <= 1)
+ while (1)
{
#if __FreeBSD_version >= 1000030
VM_OBJECT_WLOCK(pObject);
@@ -225,18 +225,22 @@
#else
VM_OBJECT_UNLOCK(pObject);
#endif
- if (pPages)
+ if (pPages || cTries >= 1)
break;
+#if __FreeBSD_version >= 1000015
vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh);
+#else
+ vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh);
+#endif
cTries++;
}
return pPages;
#else
- while (cTries <= 1)
+ while (1)
{
pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
- if (pPages)
+ if (pPages || cTries >= 1)
break;
vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh);
cTries++;

View file

@ -3,6 +3,7 @@
PORTNAME= virtualbox-ose
DISTVERSION= 4.3.8
PORTREVISION= 1
CATEGORIES= emulators
MASTER_SITES= http://download.virtualbox.org/virtualbox/${DISTVERSION}/ \
http://tmp.chruetertee.ch/ \

View file

@ -7,8 +7,8 @@ From Alan L. Cox on FreeBSD-current:
answer that question.
[1] http://lists.freebsd.org/pipermail/freebsd-current/2012-November/037963.html
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2013-11-29 12:04:53.000000000 +0100
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2013-11-29 12:37:29.000000000 +0100
--- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2014-02-25 12:09:32.000000000 -0500
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2014-03-17 13:57:00.000000000 -0400
@@ -168,14 +168,19 @@
VM_OBJECT_LOCK(pMemFreeBSD->pObject);
#endif
@ -29,7 +29,75 @@ From Alan L. Cox on FreeBSD-current:
#if __FreeBSD_version >= 1000030
VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
#else
@@ -291,11 +296,15 @@
@@ -201,12 +206,12 @@
vm_page_t pPages;
int cTries = 0;
-#if __FreeBSD_version > 1000000
+#if __FreeBSD_version >= 902508
int fFlags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY;
if (fWire)
fFlags |= VM_ALLOC_WIRED;
- while (cTries <= 1)
+ while (1)
{
#if __FreeBSD_version >= 1000030
VM_OBJECT_WLOCK(pObject);
@@ -220,18 +225,20 @@
#else
VM_OBJECT_UNLOCK(pObject);
#endif
- if (pPages)
+ if (pPages || cTries >= 1)
break;
+#if __FreeBSD_version >= 1000015
vm_pageout_grow_cache(cTries, 0, VmPhysAddrHigh);
+#else
+ vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh);
+#endif
cTries++;
}
-
- return pPages;
#else
- while (cTries <= 1)
+ while (1)
{
pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0);
- if (pPages)
+ if (pPages || cTries >= 1)
break;
vm_contig_grow_cache(cTries, 0, VmPhysAddrHigh);
cTries++;
@@ -239,11 +246,8 @@
if (!pPages)
return pPages;
-#if __FreeBSD_version >= 1000030
- VM_OBJECT_WLOCK(pObject);
-#else
+
VM_OBJECT_LOCK(pObject);
-#endif
for (vm_pindex_t iPage = 0; iPage < cPages; iPage++)
{
vm_page_t pPage = pPages + iPage;
@@ -255,13 +259,9 @@
atomic_add_int(&cnt.v_wire_count, 1);
}
}
-#if __FreeBSD_version >= 1000030
- VM_OBJECT_WUNLOCK(pObject);
-#else
VM_OBJECT_UNLOCK(pObject);
#endif
return pPages;
-#endif
}
static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
@@ -291,11 +291,15 @@
while (iPage-- > 0)
{
pPage = vm_page_lookup(pObject, iPage);