From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 13 12:52:50 2009 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 DAD6D106564A for ; Fri, 13 Mar 2009 12:52:50 +0000 (UTC) (envelope-from pekka.nikander@nomadiclab.com) Received: from n2.nomadiclab.com (n2.nomadiclab.com [IPv6:2001:14b8:400:101::2]) by mx1.freebsd.org (Postfix) with ESMTP id 996E58FC16 for ; Fri, 13 Mar 2009 12:52:50 +0000 (UTC) (envelope-from pekka.nikander@nomadiclab.com) Received: from n2.nomadiclab.com (localhost [127.0.0.1]) by n2.nomadiclab.com (Postfix) with ESMTP id D03001F4AD5 for ; Fri, 13 Mar 2009 14:52:48 +0200 (EET) Received: from [127.0.0.1] (localhost [IPv6:::1]) by n2.nomadiclab.com (Postfix) with ESMTP id 9CD2F1F4AD4 for ; Fri, 13 Mar 2009 14:52:48 +0200 (EET) Message-Id: <37364E21-701A-42F9-95B7-1B3386AEDE71@nomadiclab.com> From: Pekka Nikander To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Fri, 13 Mar 2009 14:52:48 +0200 X-Mailer: Apple Mail (2.930.3) X-Virus-Scanned: ClamAV using ClamSMTP Subject: Problems mapping an vm_object to a process memory space 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: Fri, 13 Mar 2009 12:52:51 -0000 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