Problems mapping an vm_object to a process memory space

Pekka Nikander pekka.nikander at nomadiclab.com
Fri Mar 13 05:52:51 PDT 2009


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



More information about the freebsd-hackers mailing list