Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Aug 2011 08:51:25 +0200
From:      Bernhard Froehlich <decke@FreeBSD.org>
To:        Jung-uk Kim <jkim@FreeBSD.org>
Cc:        freebsd-emulation@FreeBSD.org
Subject:   Re: PG_UNMANAGED disappearance in -current
Message-ID:  <aa5e184058b9c50d26fdaf3b3aaf06da@bluelife.at>
In-Reply-To: <201108111544.20198.jkim@FreeBSD.org>
References:  <4E441A9D.1060102@protected-networks.net> <201108111544.20198.jkim@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aa5e184058b9c50d26fdaf3b3aaf06da>