From owner-freebsd-arch Sat Feb 16 17:41:25 2002 Delivered-To: freebsd-arch@freebsd.org Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by hub.freebsd.org (Postfix) with ESMTP id 44D9B37B416; Sat, 16 Feb 2002 17:41:09 -0800 (PST) Received: from pool0237.cvx21-bradley.dialup.earthlink.net ([209.179.192.237] helo=mindspring.com) by hawk.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 16cGJq-0004kb-00; Sat, 16 Feb 2002 17:40:46 -0800 Message-ID: <3C6F0A13.258882FF@mindspring.com> Date: Sat, 16 Feb 2002 17:40:35 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Julian Elischer Cc: Matthew Dillon , Alfred Perlstein , Poul-Henning Kamp , arch@FreeBSD.ORG, jhb@FreeBSD.ORG, peter@wemm.org, jake@locore.ca Subject: Re: gettimeofday() and crhold()/crfree() (was Re: gettimeofday()and copyout(). Is copyout() MPSAFE on non-i386 archs? ) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This whole cred thing on gettimeofday is silly. I was able to ensure that the contents of a copy of the timecounter context struct were rotated between two buffers with an atomic pointer update, each time they were updated. I really don't understand the need for a very large pool of these things, and I don't really understand the need for locking, so long as the pointer change is atomic, and the clock update is always handled b y a single processor. By taking this single page, two structure, area, and setting up an additional mapping, read-only, with the PG_G and PG_U bits set, the pointer can be directly dereferenced from user space, providing an accurate zero system call "gettimeofday" call (the easy part is copying the kernel space code for the structure content use to user space). With the PG_U bit set on the page, the same pointer can be used in both user and kernel space to access the snapshot structure, so there's no decoherence from the change from kernel space copy to user space dereference. Pretty simple, actually. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message