Re: [ACPI] Re: Linux 2.4.26-rc1 (cmpxchg vs 80386 build)

From: Denis Vlasenko
Date: Sat May 08 2004 - 05:19:55 EST

> In Intel machines ALL memory operations are atomic. What
> the means is that if I make code that does:
> addl %eax,(memory)
> ... what's in memory will always be the sum of what it was
> before and the value in the EAX register.

Except on SMP.

> A long time ago, somebody invented the 'lock' instruction
> for Intel machines. It turns out that the first ones locked
> the whole bus during an operation. Eventually somebody looked
> at that, and by the time the '486 came out, they no longer
> locked the whole bus. Then somebody else said; "WTF...
> Why do we even need this stuff". It was a throw-back to
> early primitive machines where there were only load and
> store operations in memory. All arithmetic had to be done
> in registers. Now, there are only a couple instructions you
> can use the lock prefix with, or you get an invalid opcode
> trap, and they are really no-ops because the instruction
> itself is atomic.

Not on SMP. On SMP, lock prefix *is needed*.

If you think I'm wrong, point me to the relevant docs.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at