From owner-freebsd-threads@FreeBSD.ORG Wed Nov 19 15:39:03 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 17E7016A4CE for ; Wed, 19 Nov 2003 15:39:03 -0800 (PST) Received: from ms-smtp-01-eri0.socal.rr.com (ms-smtp-01-qfe0.socal.rr.com [66.75.162.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id F323843FB1 for ; Wed, 19 Nov 2003 15:39:01 -0800 (PST) (envelope-from sean@mcneil.com) Received: from blue.mcneil.com (cpe-66-75-176-109.socal.rr.com [66.75.176.109])hAJNcrcX014438; Wed, 19 Nov 2003 15:38:59 -0800 (PST) Received: from [66.75.176.109] (mcneil.com [66.75.176.109]) by blue.mcneil.com (8.12.10/8.12.10) with ESMTP id hAJNclUe004793; Wed, 19 Nov 2003 15:38:47 -0800 (PST) (envelope-from sean@mcneil.com) From: Sean McNeil To: Jeff Roberson In-Reply-To: <20031119165234.D10222-100000@mail.chesapeake.net> References: <20031119165234.D10222-100000@mail.chesapeake.net> Content-Type: text/plain Organization: Sean McNeil Consulting Message-Id: <1069285127.4781.2.camel@blue.mcneil.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Wed, 19 Nov 2003 15:38:47 -0800 Content-Transfer-Encoding: 7bit X-DCC-dmv.com-Metrics: blue.mcneil.com 1181; Body=3 Fuz1=3 Fuz2=3 cc: freebsd-threads@freebsd.org Subject: Re: Losing pages from a mmap in threaded app vs. non-threaded X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2003 23:39:03 -0000 Actually, what I'm doing is looking through the process map. What I'm seeing is that the first 8 pages are always missing. Here is the routine that I'm using: static vm_map_entry_t find_entry (vm_map_t map, vm_paddr_t addr) { vm_map_entry_t entry = &map->header; while (1) { vm_page_t page; vm_paddr_t paddr; vm_object_t object; if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) { vm_map_entry_t sub_entry = find_entry (entry->object.sub_map, addr); if (sub_entry) return sub_entry; goto next_entry; } object = entry->object.vm_object; if (object == NULL || object->type != OBJT_DEVICE) goto next_entry; VM_OBJECT_LOCK (object); TAILQ_FOREACH (page, &object->un_pager.devp.devp_pglist, pageq) { if (VM_PAGE_TO_PHYS (page) == addr) { VM_OBJECT_UNLOCK (object); return entry; } } VM_OBJECT_UNLOCK (object); next_entry: entry = entry->next; if (entry == &map->header) break; } return NULL; } I've actually tested now with memory mmap'd with an offset of both 0x40000000 and 0x04000000 same results with both. The result being entry returned by the above routine is NULL. Sean On Wed, 2003-11-19 at 13:54, Jeff Roberson wrote: > On Wed, 19 Nov 2003, Sean McNeil wrote: > > > Yes, I mentioned this in my original post. They all have the same > > problem. > > If you mount procfs you can look through the vm map for the process. You > want /proc//map I believe. Please note that the address returned by > your driver routine is a physical address that will be mapped by the > kernel at a new virtual address. User-space can pass you only the offset > into your memory range, and not a real address. > > Cheers, > Jeff > > > > > On Wed, 2003-11-19 at 13:38, Jeff Roberson wrote: > > > On Wed, 19 Nov 2003, Daniel Eischen wrote: > > > > > > > On Wed, 19 Nov 2003, Sean McNeil wrote: > > > > > > > > > OK, would this happen to be 8 pages typically? > > > > > > > > It depends; see the comment and ascii art in > > > > src/lib/libpthread/thread/thr_alloc.c. > > > > > > Have you tried with libc_r, libthr, and libkse? > > > > > > > > > > > -- > > > > Dan Eischen > > > > > > > > _______________________________________________ > > > > freebsd-threads@freebsd.org mailing list > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > > > > To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org" > > > > > > > > > >