Messages in this thread | | | From | Roland Dreier <> | Subject | Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic | Date | Fri, 22 May 2009 12:24:36 -0700 |
| |
> Unless you have interrupts enabled, then you have two contexts. > Only xchg is "naturally" atomic.
Isn't the lock prefix about consistency between multiple processors? The x86 architecture always handles interrupts on instruction boundaries. I'm guessing you're worried about definitions like
static inline void atomic_inc(atomic_t *v) { asm volatile(LOCK_PREFIX "incl %0" : "+m" (v->counter)); }
which compiles to just "incl" (with no lock prefix) on uniprocessor kernels; but the IA-32 architecture guarantees that the incl instruction cannot be interrupted between reading the old value and writing the new value.
- R.
| |