Re: volatile and atomic_t/spinlock_t

2007-06-05 Thread Heiko Carstens
On Tue, Jun 05, 2007 at 11:38:27AM -0700, Luck, Tony wrote: > > So is > > > > while (__raw_spin_is_locked(&v)); > > > > supposed to work? Or should that be > > > > while (__raw_spin_is_locked(&v)) > > cpu_relax(); > > > > as well and all the volatiles can/should go away? > > c

RE: volatile and atomic_t/spinlock_t

2007-06-05 Thread Luck, Tony
> So is > > while (__raw_spin_is_locked(&v)); > > supposed to work? Or should that be > > while (__raw_spin_is_locked(&v)) > cpu_relax(); > > as well and all the volatiles can/should go away? cpu_relax() is a really good idea in every spinloop on hyper-threaded cores. I

volatile and atomic_t/spinlock_t

2007-06-05 Thread Heiko Carstens
I'm just wondering why we have an inconsistency between several archs when it comes to the definitions of atomic_t, atomic64_t, spinlock_t and their accessors. Currently we have on most architectures something like typedef struct { volatile int counter; } atomic_t; except for i386/x86_64 which ha