From owner-freebsd-hackers@FreeBSD.ORG Thu Mar 13 21:57:01 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3D4106566C for ; Thu, 13 Mar 2008 21:57:01 +0000 (UTC) (envelope-from nikhil.rao@intel.com) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx1.freebsd.org (Postfix) with ESMTP id AFB0A8FC1E for ; Thu, 13 Mar 2008 21:57:01 +0000 (UTC) (envelope-from nikhil.rao@intel.com) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 13 Mar 2008 14:57:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.25,496,1199692800"; d="scan'208";a="306041710" Received: from orsmsx334.amr.corp.intel.com (HELO orsmsx334.jf.intel.com) ([10.22.226.45]) by fmsmga002.fm.intel.com with ESMTP; 13 Mar 2008 14:55:08 -0700 Received: from orsmsx419.amr.corp.intel.com ([10.22.226.88]) by orsmsx334.jf.intel.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 13 Mar 2008 14:56:23 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 13 Mar 2008 14:56:22 -0700 Message-ID: <12A5C15467D5B94F8E0FF265D9498ADD02B6AFB3@orsmsx419.amr.corp.intel.com> In-reply-to: <1339BE9A-9B99-49D0-B626-FD64C442D1EE@colorado.edu> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Shared VM address range across processes Thread-Index: AciFVFDHCfWrduQcToGEeISe5xwVBwAAHnYg References: <12A5C15467D5B94F8E0FF265D9498ADD02B35F81@orsmsx419.amr.corp.intel.com> <006DB5A0-3669-473B-84B6-E3C8CC3C059D@colorado.edu> <12A5C15467D5B94F8E0FF265D9498ADD02B6AF6A@orsmsx419.amr.corp.intel.com> <1339BE9A-9B99-49D0-B626-FD64C442D1EE@colorado.edu> From: "Rao, Nikhil" To: "John Giacomoni" X-OriginalArrivalTime: 13 Mar 2008 21:56:23.0576 (UTC) FILETIME=[14160180:01C88555] Cc: freebsd-hackers@freebsd.org Subject: RE: Shared VM address range across processes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Mar 2008 21:57:02 -0000 You still need to add the VA range to the proc->vm_space of every process right ? Nikhil -----Original Message----- From: John Giacomoni [mailto:john.giacomoni@colorado.edu]=20 Sent: Thursday, March 13, 2008 2:50 PM To: Rao, Nikhil Cc: freebsd-hackers@freebsd.org Subject: Re: Shared VM address range across processes Nikhil, I am using kernel addresses to ensure that once the memory region is =20 allocated it is available to everyone, even for late joiners who might have an =20 address range conflict. If you can predetermine or or otherwise simultaneously ensure the =20 address range is available for everyone life maybe easier :) I haven't looked into =20 it but mapping userspace pages should be easier. John G On Mar 13, 2008, at 3:27 PM, Rao, Nikhil wrote: > > Hi John, > > Is the approach that you are working on based on necessarily using the > kernel address space, so is this approach not feasible with user space > virtual addresses ? > > Nikhil > > -----Original Message----- > From: John Giacomoni [mailto:john.giacomoni@colorado.edu] > Sent: Thursday, March 13, 2008 9:13 AM > To: freebsd-hackers@freebsd.org > Cc: Rao, Nikhil > Subject: Re: Shared VM address range across processes > > Nihkil, > > I'm working on something similar for a research project and the answer > is that it is possible but ugly. > > First, are you sure you need to do this? Ensuring safety by checking > pointers before dereferencing can be painful :) > > FreeBSD seems to have checks scattered throughout the kernel trying to > ensure that the kernel address range remains unavailable to the > userspace > address range. These checks can obviously be bypassed but they are > fairly > invasive. Once all those checks are bipassed, you need to ensure that > the > PTEs and PDEs are have the userspace bit set for the appropriate page > ranges which then requires flushing the specific pages out of the TLB > using the invlpg function, note that flushing the TLB is =20 > insufficient as > kernel pages are marked global and thus won't flush with any other > method. > > files that I touched > > /usr/src/sys/amd64/amd64/pmap.c - pmap_enter > > /usr/src/sys/amd64/amd64/trap.c - trap_pfault > > and the allocation site needs to ensure that the user-mode bit is =20 > set on > the correct PTEs and PDEs. > > I directly allocate memory using vm objects to help me bypass the > various > address range checks that can be found in the higher levels of the > kernel. > > I'm planning on generalizing and cleaning my approach up in the next =20 > few > months but I'll be glad to answer any specific questions you might =20 > have. > > > For the FreeBSD kernel developers, > > Is there a reason to enforce the high/low mem address range as =20 > strongly > as is done in FreeBSD? It seems that if the higher-levels of the =20 > kernel > allow a mapping, the lower-levels should respect that. > > John G > > > > On Mar 12, 2008, at 12:46 PM, Rao, Nikhil wrote: > >> Hi, >> >> >> >> I want to map device memory into the same virtual address range in >> multiple processes, this means I would have to add a vm_map_entry per >> address range in every process, since the list of processes can be >> potentially huge .. Is it allowed to point to the same list of >> vm_map_entrys from multiple vm_spaces ? BSD3 had a field in the >> vm_map_entry that could be a share map - would it be an idea that I >> could reuse ? >> >> >> >> Nikhil >> >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to > "freebsd-hackers-unsubscribe@freebsd.org >> " > > > -- > > John.Giacomoni@colorado.edu > University of Colorado at Boulder > Department of Computer Science > Engineering Center, ECCR 1B50 > 430 UCB > Boulder, CO 80303-0430 > USA > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org=20 > " -- John.Giacomoni@colorado.edu University of Colorado at Boulder Department of Computer Science Engineering Center, ECCR 1B50 430 UCB Boulder, CO 80303-0430 USA