Re: ZFS committed to the FreeBSD base.

From: Daniel Cheng <gmane_at_sdiz.net>
Date: Sat, 14 Apr 2007 22:47:11 +0800
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

-- 
Received on Sat Apr 14 2007 - 12:55:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:08 UTC