From owner-freebsd-virtualization@FreeBSD.ORG Thu Feb 3 17:11:51 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 CA617106566C for ; Thu, 3 Feb 2011 17:11:51 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 99B0D8FC1A for ; Thu, 3 Feb 2011 17:11:51 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p13HBm0D061367 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 3 Feb 2011 09:11:50 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4D4AE1D7.9030106@freebsd.org> Date: Thu, 03 Feb 2011 09:11:51 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: "Bjoern A. Zeeb" 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> In-Reply-To: <20110203105747.K80258@maildrop.int.zabbadoz.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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: Thu, 03 Feb 2011 17:11:51 -0000 On 2/3/11 2: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 >>>>> system would >>>>> be >>>>> on vnet0 >>>>> in a vimage kernel. >>>> >>>> This is how my printf looks like: >>>> struct thread *td = curthread; >>>> struct vnet *v = TD_TO_VNET(td); >>>> struct ucred *cred = CRED_TO_VNET(td->ucred); >>>> struct vnet *td_vnet = td->td_vnet; >>> >>> here's your problem: >>> >>> strcut vnet *vnet = 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 = 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. If it's not that would explain a lot of things. > > >>>> printf("td=%p, td->td_vnet=%p, td->td_ucred=%p, TD_TO_VNET=%p, >>>> CRED_TO_VNET=%p\n", td, td_vnet, td->td_ucred, v, cred); >>>> >>>> I made a fast search in /usr/src for "td_vnet" and found it was >>>> assigned only in >>>> int fork1(td, flags, pages, procp): >>>> #ifdef VIMAGE >>>> td2->td_vnet = NULL; >>>> td2->td_vnet_lpush = NULL; >>>> #endif >>> >>> Nice try. Want another search? Hint: there is this in vnet.h: >>> >>> #define curvnet curthread->td_vnet >>> >>> And then you'll, again, find the CURVNET_SET_* macros. >> >> Thank you > > Something you may find useful as well btw is: > > http://people.freebsd.org/~bz/20100530-02.vnet.9.html that's excellent! checkin? > > > _______________________________________________ > 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"