Craig Boston <craig_at_xfoil.gank.org> writes: > On Thu, Apr 12, 2007 at 11:06:03AM -0500, Rick C. Petty wrote: > > 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)) > For something this low level my opinion is it's better to stay with > compile time options. After all, in the above example, cmpxchg8 is a > single machine instruction. How much overhead does it add to retrieve a > variable from memory and check it, then jump to the correct place? > Enough that it outweighs the benefit of using that instruction in the > first place? I don't think it matters. Contrary to popular belief, atomic operations are *expensive*. In the best case, on a UP machine, they stall the pipeline. In the worst case, on an SMP machine, they stall the entire memory bus. DES -- Dag-Erling Smørgrav - des_at_des.noReceived on Thu Apr 12 2007 - 18:43:13 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:08 UTC