From owner-freebsd-fs@FreeBSD.ORG Sat Apr 14 14:50:25 2007 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AD9C716A406 for ; Sat, 14 Apr 2007 14:50:25 +0000 (UTC) (envelope-from freebsd-fs@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id 6B5AC13C489 for ; Sat, 14 Apr 2007 14:50:25 +0000 (UTC) (envelope-from freebsd-fs@m.gmane.org) Received: from root by ciao.gmane.org with local (Exim 4.43) id 1HcjZi-0002rK-KF for freebsd-fs@freebsd.org; Sat, 14 Apr 2007 16:50:02 +0200 Received: from n220246159048.netvigator.com ([220.246.159.48]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 14 Apr 2007 16:50:02 +0200 Received: from gmane by n220246159048.netvigator.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 14 Apr 2007 16:50:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-fs@freebsd.org From: Daniel Cheng Date: Sat, 14 Apr 2007 22:47:11 +0800 Lines: 29 Message-ID: References: <20070406025700.GB98545@garage.freebsd.pl> <86k5wo55s0.fsf@dwp.des.no> <20070407203411.GJ8831@cicely12.cicely.de> <86wt0n3mxv.fsf@dwp.des.no> <20070411214911.GA38351@VARK.MIT.EDU> <20070412073605.GB834@turion.vk2pj.dyndns.org> <86ps6aht1i.fsf@dwp.des.no> <20070412160603.GB92079@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=Big5-HKSCS Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: n220246159048.netvigator.com User-Agent: Icedove 1.5.0.10 (X11/20070329) In-Reply-To: <20070412160603.GB92079@keira.kiwi-computer.com> Sender: news Cc: freebsd-current@freebsd.org Subject: Re: ZFS committed to the FreeBSD base. X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Apr 2007 14:50:25 -0000 Rick C. Petty wrote: > On Thu, Apr 12, 2007 at 10:54:17AM +0200, Dag-Erling Sm?rgrav wrote: >> Our native atomic operations are all defined as either macros or >> static inline functions in machine/atomic.h, so we can easily make >> this choice at compile time based on a config option. > > Is there any way we could make the choice at boot time, by checking for > presence of the CX8 feature? Either as something like: > > extern int feature_cx8; /* or MIB variable */ > #define CMPXCHG8(a) (feature_cx8 ? { _asm "..." } : emulate_cmpxch8(a)) > In Linux, Two copies of code are compiled: one with cmpxch8, one without. They are placed into different sections. When the computer boot up, it choose the best code, update the pointers then free the unused codes memory. > Otherwise something like ZFS which utilizes this feature a lot could > check the MIB variable and set different fn ptr in its device structure, > or something along those lines. Of course, that would require compiling > the same code twice essentially, but it had the advantage that it would > work on non-CX8 systems and that it would be fast on systems with CX8. > > -- Rick C. Petty --