From owner-freebsd-virtualization@FreeBSD.ORG Fri Feb 4 07:16:12 2011 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0B5810656A6 for ; Fri, 4 Feb 2011 07:16:12 +0000 (UTC) (envelope-from ady@ady.ro) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8A5F68FC12 for ; Fri, 4 Feb 2011 07:16:12 +0000 (UTC) Received: by gyf3 with SMTP id 3so849956gyf.13 for ; Thu, 03 Feb 2011 23:16:11 -0800 (PST) Received: by 10.236.110.172 with SMTP id u32mr23428828yhg.63.1296802049581; Thu, 03 Feb 2011 22:47:29 -0800 (PST) MIME-Version: 1.0 Sender: ady@ady.ro Received: by 10.236.105.230 with HTTP; Thu, 3 Feb 2011 22:47:09 -0800 (PST) In-Reply-To: <20110203193259.L80258@maildrop.int.zabbadoz.net> References: <4D484213.6050100@freebsd.org> <4D486108.5060805@freebsd.org> <20110202164827.I80258@maildrop.int.zabbadoz.net> <4D4994CE.2090209@freebsd.org> <4D49AB29.7070909@freebsd.org> <20110203095019.N80258@maildrop.int.zabbadoz.net> <20110203105747.K80258@maildrop.int.zabbadoz.net> <20110203111206.S80258@maildrop.int.zabbadoz.net> <20110203193259.L80258@maildrop.int.zabbadoz.net> From: Adrian Penisoara Date: Fri, 4 Feb 2011 08:47:09 +0200 X-Google-Sender-Auth: 8uDIe6dFN1v7cg92O_MiQYSE8bI Message-ID: To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD virtualization mailing list Subject: Re: simulating wireless device (if_alloc panic, VirtualBox, VIMAGE) X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Feb 2011 07:16:12 -0000 Hi, Since we're going to see VIMAGE (partly) committed into HEAD anytime now, perhaps it would be a good time to make available some clear developer documentation on how to cope with VIMAGE in the kernel (at kernel build time or building a module separately). 3rd party driver vendors will be most interested in this. PS: it would be very welcoming for such mechanisms to be elegant in their usage ;)... Thank you, Adrian. On Thu, Feb 3, 2011 at 9:35 PM, Bjoern A. Zeeb wrote: > On Thu, 3 Feb 2011, Monthadar Al Jaberi wrote: > >> On Thu, Feb 3, 2011 at 12:18 PM, Bjoern A. Zeeb >> wrote: >>> >>> On Thu, 3 Feb 2011, Monthadar Al Jaberi wrote: >>> >>>> On Thu, Feb 3, 2011 at 11:59 AM, Bjoern A. Zeeb >>>> wrote: >>>>> >>>>> On Thu, 3 Feb 2011, Monthadar Al Jaberi wrote: >>>>> >>>>>>>>> I don't understand why you saw a CRED_TO_VNET of 0 >>>>>>>>> I was under the impression that every process/thread in the syste= m >>>>>>>>> would >>>>>>>>> be >>>>>>>>> on vnet0 >>>>>>>>> in a vimage kernel. >>>>>>>> >>>>>>>> This is how my printf looks like: >>>>>>>> struct thread *td =3D curthread; >>>>>>>> struct vnet *v =3D TD_TO_VNET(td); >>>>>>>> struct ucred *cred =3D CRED_TO_VNET(td->ucred); >>>>>>>> struct vnet *td_vnet =3D td->td_vnet; >>>>>>> >>>>>>> here's your problem: >>>>>>> >>>>>>> strcut vnet *vnet =3D cred->cr_prison->pr_vnet; >>>>>> >>>>>> When I add CURVNET_SET(CRED_TO_VNET(curthread->td_ucred)); I get a >>>>>> panic >>>>>> too... >>>>>> But your suggestion works if I do like this: >>>>>> curthread->td_vnet =3D curthread->td_ucred->cr_prison->pr_vnet; >>>>>> >>>>>> CRED_TO_VNET(curthread->td_ucred) returns NULL >>>>> >>>>> I wonder how you are building your module and if VIMAGE is properly >>>>> defined. =A0If it's not that would explain a lot of things. >>>> >>>> I have put options VIMAGE, rebuild both world and kernel. >>>> >>>> I can create jails with vnet options... >>>> >>>> I build my module with the standard Makefile for modules: >>>> ... >>>> KMOD =A0 =A0=3D =A0wtap >>>> ... >>>> SRCS =A0 =A0=3D =A0if_wtap_module.c if_wtap.c if_medium.c hal.c >>>> >>>> .include >>> >>> Right but are you building your module along with the kernel or >>> outside the tree? =A0In the latter case you may want to add soemthing >>> like >>> >>> SRCS+=3D =A0 =A0 =A0 =A0 =A0opt_global.h >>> >>> .if defined(KERNBUILDDIR) >>> MKDEP=3D =A0 =A0 =A0 =A0 =A0-include ${KERNBUILDDIR}/opt_global.h >>> .else >>> CFLAGS+=3D =A0 =A0 =A0 =A0-include opt_global.h >>> MKDEP=3D =A0 =A0 =A0 =A0 =A0-include opt_global.h >>> >>> opt_global.h: >>> =A0 =A0 =A0 =A0echo "#define VIMAGE 1" > ${.TARGET} >>> .endif >>> >>> and/or point KERNBUILDDIR to where you built your kernels. >> >> Thanks it works now.. > > > One thing you should be aware of is that if you will compile without > KERNBUILDDIR set, your module will not work on a non-VIMAGE kernel. > > Unfortuantely we can only have defaults for one or the other in the > case. =A0Worst you may want to only do the "echo" if there was a command > line option like -DVIMAGE or the like. =A0Note, setting it to 0 will not > do the trick as it would still be defined. > > /bz > > -- > Bjoern A. Zeeb =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 You have to have visions! > =A0 =A0 =A0 =A0 Going to jail sucks -- All my daemons like it! > =A0http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html > _______________________________________________ > freebsd-virtualization@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization > To unsubscribe, send any mail to > "freebsd-virtualization-unsubscribe@freebsd.org" > >