PG_UNMANAGED disappearance in -current

Bernhard Froehlich decke at FreeBSD.org
Fri Aug 12 06:51:26 UTC 2011


On Thu, 11 Aug 2011 15:44:12 -0400, Jung-uk Kim wrote:
> On Thursday 11 August 2011 02:08 pm, Michael Butler wrote:
>> /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.0.12_OSE
>>/out/freebsd.x86/release/bin/src/vboxdrv/r0drv/freebsd/memobj-r0drv-
>>freebsd.c: In function 'rtR0MemObjFreeBSDPhysPageInit':
>>
>> /usr/ports/emulators/virtualbox-ose-kmod/work/VirtualBox-4.0.12_OSE
>>/out/freebsd.x86/release/bin/src/vboxdrv/r0drv/freebsd/memobj-r0drv-
>>freebsd.c:396: error: 'PG_UNMANAGED' undeclared (first use in this
>> function)
>>
>> Should "pPage->flags = PG_UNMANAGED" now be replaced by some page
>> lock/unlock function which applies "pPage->oflags = VPO_UNMANAGED"?
> 
> I am not sure if it is really correct but this patch worked for me:
> 
> --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig
> +++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
> @@ -392,8 +392,13 @@
>      pPage->wire_count = 1;
>      pPage->pindex     = iPage;
>      pPage->act_count  = 0;
> +#if __FreeBSD_version < 900000
>      pPage->oflags     = 0;
>      pPage->flags      = PG_UNMANAGED;
> +#else
> +    pPage->oflags     = VPO_UNMANAGED;
> +    pPage->flags      = 0;
> +#endif
>      atomic_add_int(&cnt.v_wire_count, 1);
>  }

I have started the same way and then talked to kib. He told me that
vm_phys_alloc_contig() already initializes the page as unmanaged so this
stuff should be a noop in the kmod. I have not runtime tested it myself
though so i would welcome some feedback on that.

http://home.bluelife.at/patches/patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c

---
src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig	2011-04-05
14:34:09.000000000 +0200
+++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	2011-08-11
15:06:46.000000000 +0200
@@ -394,9 +394,13 @@
     pPage->wire_count = 1;
     pPage->pindex     = iPage;
     pPage->act_count  = 0;
-    pPage->oflags     = 0;
-    pPage->flags      = PG_UNMANAGED;
     atomic_add_int(&cnt.v_wire_count, 1);
+
+#if __FreeBSD_version >= 900040
+    Assert(pPage->oflags & VPO_UNMANAGED != 0);
+#else
+    Assert(pPage->flags & PG_UNMANAGED != 0);
+#endif
 }

-- 
Bernhard Froehlich
http://www.bluelife.at/


More information about the freebsd-emulation mailing list