From owner-freebsd-current@FreeBSD.ORG Fri May 12 08:03:31 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 714EE16A402; Fri, 12 May 2006 08:03:31 +0000 (UTC) (envelope-from lists@wm-access.no) Received: from lakepoint.domeneshop.no (lakepoint.domeneshop.no [194.63.248.54]) by mx1.FreeBSD.org (Postfix) with ESMTP id C70D443D46; Fri, 12 May 2006 08:03:30 +0000 (GMT) (envelope-from lists@wm-access.no) Received: from [192.168.9.48] (gw1.arcticwireless.no [80.203.184.14]) (authenticated bits=0) by lakepoint.domeneshop.no (8.13.6/8.13.6) with ESMTP id k4C83Qb1012741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 12 May 2006 10:03:26 +0200 Message-ID: <4464414A.80100@wm-access.no> Date: Fri, 12 May 2006 10:03:22 +0200 From: =?ISO-8859-1?Q?Sten_Daniel_S=F8rsdal?= User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Peter Jeremy , David Xu , Daniel Eischen , current@freebsd.org 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> <446165B5.7030006@freebsd.org> <20060510074547.GA700@turion.vk2pj.dyndns.org> In-Reply-To: <20060510074547.GA700@turion.vk2pj.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: 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 08:03:31 -0000 Peter Jeremy wrote: > SunOS 4 (not sure about SunOS 5) exports a per-CPU page that > includes a high-resolution timer amongst other things. >=20 > 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. >=20 > A lot of the need for atomic operations goes away if the page (or > whatever) refers to the current CPU - the page is either being updated > by the current CPU in kernel mode or read by the current CPU in > userland. The page won't be updated/accessed by other CPUs. You > still need to update the base time and TSC (or whatever) count in a > way that looks atomic to userland but I suspect the kernel could > achieve this by twiddling the code transparently to userland (eg there > are two copies of the base/count and the kernel flips a pointer > between then). >=20 > On Wed, 2006-May-10 12:01:57 +0800, David Xu wrote: >> Daniel Eischen wrote: >>> Can you not make a simple pseudo device driver and mmap the page? >>> >> mmap is fine if you don't care binary compatible, exporting a kernel >> page which can be executed by userland is more flexible, kernel can >> change it freely without having to change libc. >=20 > These aren't mutually exclusive - .so's are mmap'd. All libc needs > to do is mmap a page from a pseudo device and execute a function in > it. Either the function could be at a magic address or the pseudo > device could simulate a shared object so you just dlopen() the device. >=20 How about making the scheduler insert the current time into something resembling in functionality of a cpu local variable (register? cache area?) whenever there is a context switch by the scheduler. Then whenever you need the current time the userland application would read it off this cpu local variable/holy area requiring no additional context switch. Or do the currently running (on that cpu) userland application require the ability to read the current time more often than once per "time slot"? Do i make sense? *ducks for cover* --=20 Sten Daniel S=F8rsdal