From owner-freebsd-current@FreeBSD.ORG Fri May 12 20:41:24 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 971DA16AA2E; Fri, 12 May 2006 20:41:24 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id E93D443D53; Fri, 12 May 2006 20:41:17 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.13.6/8.13.6) with ESMTP id k4CKfGpQ014633 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Fri, 12 May 2006 16:41:17 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id k4CKfBVH025573; Fri, 12 May 2006 16:41:11 -0400 (EDT) (envelope-from gallatin) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17508.62183.562795.176709@grasshopper.cs.duke.edu> Date: Fri, 12 May 2006 16:41:11 -0400 (EDT) To: Daniel Eischen In-Reply-To: References: <20060506150622.C17611@fledge.watson.org> <20060509181302.GD3636@eucla.lemis.com> <20060509182330.GB92714@xor.obsecurity.org> <200605100726.28243.davidxu@freebsd.org> <44613469.2050000@freebsd.org> <4461522D.9060405@freebsd.org> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Cc: David Xu , current@freebsd.org Subject: Re: Fine-grained locking for POSIX local sockets (UNIX domain sockets) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 May 2006 20:41:25 -0000 Daniel Eischen writes: > On Wed, 10 May 2006, David Xu wrote: > > One of the problems to implement it is that atomic operations, > > if there are multiple integer needs to be updated by kernel, > > userland maybe gets an inconsistent result, the way to avoid the > > problem is using two generation numbers. > > > > http://gsu.linux.org.tr/~mpekmezci/kernelapi/unitedlinux/arch/x86_64/kernel/vsyscall.c.html > > check do_vgettimeofday(struct timeval * tv): > > > > Another problem is how you tell userland the address of the kernel > > page ? do you use fixed address or tell it via program headers like > > the PT_TLS set by kernel, check /usr/src/lib/libc/gen/tls.c. > > Can you not make a simple pseudo device driver and mmap the page? In addition to this linux vsyscall, there is the MacOSX/Darwin commpage. The map machine-specific implementations of atomic operations, bcopy, bzero, spinlocks, pthread_getspecific, etc into a common page mapped into userspace applications. The also do a (mostly) syscall-free gettimeoday this way. See http://fxr.watson.org/fxr/source/osfmk/ppc/commpage/?v=xnu-792 Obviously, we could not take the code due to APSL infection (unless Apple were to donate it), but it is something else to look at. Drew