Re: [PATCH 1/24] make atomic_read() behave consistently on alpha

From: Segher Boessenkool
Date: Thu Aug 09 2007 - 15:27:01 EST


If you need to guarantee that the value is written to memory at a particular time in your execution sequence, you either have to read it from memory to force the compiler to store it first

That isn't enough. The CPU will happily read the datum back from
its own store queue before it ever hit memory or cache or any
external bus. If you need the value to be globally visible before
another store, you use wmb(); if you need it before some read,
you use mb().

These concepts are completely separate from both atomicity and
volatility (which aren't the same themselves).

No, but I can reason about it and be confident that this won't break anything that isn't already broken. At worst, this patch will make any existing subtly incorrect uses of atomic_t much more obvious and easier to track down.

PR22278, PR29753 -- both P2 bugs, and both about basic *(volatile *)
usage. Yeah, it's definitely not problematic, esp. not if you want
to support older compilers than 4.2 too.</sarcasm>


Segher

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/