Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Mar 2009 22:53:17 +0200
From:      Pekka Nikander <pekka.nikander@nomadiclab.com>
To:        Alexej Sokolov <bsd.quest@googlemail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Problems mapping an vm_object to a process memory space
Message-ID:  <F3B55F59-EC85-4124-A405-4950F2F723B1@nomadiclab.com>
In-Reply-To: <671bb5fc0903131118u31b5b9b6l46b5d063aee78ff0@mail.gmail.com>
References:  <37364E21-701A-42F9-95B7-1B3386AEDE71@nomadiclab.com> <671bb5fc0903131118u31b5b9b6l46b5d063aee78ff0@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Alexej,

The actual mapping code is now at http://pastebin.com/m56a949a5   The  
objects in question are allocated through vm_pager_allocate with  
OBJT_SWAP.  Note that I'm not sure when OBJ_ONEMAPPING clearing  
actually helps and when not -- I've more sprinkled it around the code  
in the hope of circumventing what I suspect is a bug.  (But I also  
have to confess that I don't understand the internals of  
vm_object_deallocate well enough to really say where the bug might be,  
if there is one.)  The code around lines 110-117 is my latest attempt  
to fix.  The earlier version simply wired the pages.

--Pekka


On 13 Mar 2009, at 20:18, Alexej Sokolov wrote:

> hi ,
> I had a problem with remapping too. Could I see your code?
> here is my code, that some times on AMD64 runs wrong :
> http://pastebin.com/m78da0b37
>
> And now I solved the problem with remapping by using /dev/mem  
> device. It has mmap syscal. And it seems to be working without  
> problem.
>
> Alexej
> <
>
> 2009/3/13 Pekka Nikander <pekka.nikander@nomadiclab.com>
> As a part of a research project, I'm trying to build publish/ 
> subscribe shared memory semantics where the idea is to first map an  
> vm_object as read/write to a publisher's memory space, and then a  
> COW shadow of that later to the subscriber processes' memory space.
>
> I've got to the point where the code works most of the time, but at  
> certain scenarios (which are hard to classify and seem slightly  
> random) the mapping goes wrong, and either the subscriber process  
> has no physical mapping at the supposed address or there appears  
> some random page.   To me it appears as if the vm_object, vm_map etc  
> data structures are OK, but somehow the pmaps don't get right.  I'm  
> currently using 7.1 RELEASE on amd64, but I'm planning to try the  
> same on -CURRENT as soon as I get it properly ported.  I even tried  
> calling pmap_enter_object explicitly before returning to the user  
> space, but it doesn't seem to help.
>
> Another thing is that there may be some bugs related  
> OBJ_ONEMAPPING.  We need to explicitly clear it at places, and  
> sometimes artificially bump up the vm_object reference count to  
> avoid code related to ONEMAPPING from trashing the object's  
> mappings.  Is this a known issue?
>
> Any advice?
>
> --Pekka Nikander
>
> _______________________________________________
> 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 
> "
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F3B55F59-EC85-4124-A405-4950F2F723B1>