Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Segher Boessenkool
Anyway, what's the supposed advantage of *(volatile *) vs. using a real volatile object? That you can access that same object in a non-volatile way? You'll have to take that up with Linus and the minds behind Volatile Considered Harmful, but the crux of it is that volatile objects are prone t

Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Segher Boessenkool
Anyway, what's the supposed advantage of *(volatile *) vs. using a real volatile object? That you can access that same object in a non-volatile way? That's my understanding. That way accesses where you don't care about volatility may be optimised. But those accesses might be done non-atomic

Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Chris Friesen
Segher Boessenkool wrote: Anyway, what's the supposed advantage of *(volatile *) vs. using a real volatile object? That you can access that same object in a non-volatile way? That's my understanding. That way accesses where you don't care about volatility may be optimised. For instance, i

Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Chris Snook
Segher Boessenkool wrote: Explicit +casting in atomic_read() ensures consistent behavior across architectures +and compilers. Even modulo compiler bugs, what makes you believe that? When you declare a variable volatile, you don't actually tell the compiler where you want to override its def

Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Segher Boessenkool
Explicit +casting in atomic_read() ensures consistent behavior across architectures +and compilers. Even modulo compiler bugs, what makes you believe that? When you declare a variable volatile, you don't actually tell the compiler where you want to override its default optimization behavior,

Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Chris Snook
Segher Boessenkool wrote: Historically this has been +accomplished by declaring the counter itself to be volatile, but the +ambiguity of the C standard on the semantics of volatile make this practice +vulnerable to overly creative interpretation by compilers. It's even worse when accessing th

Re: [PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Segher Boessenkool
Historically this has been +accomplished by declaring the counter itself to be volatile, but the +ambiguity of the C standard on the semantics of volatile make this practice +vulnerable to overly creative interpretation by compilers. It's even worse when accessing through a volatile casted poi

[PATCH 24/24] document volatile atomic_read() behavior

2007-08-09 Thread Chris Snook
From: Chris Snook <[EMAIL PROTECTED]> Update atomic_ops.txt to reflect the newly consistent behavior of atomic_read(), and to note that volatile (in declarations) is now considered harmful. Signed-off-by: Chris Snook <[EMAIL PROTECTED]> --- linux-2.6.23-rc2-orig/Documentation/atomic_ops.txt 200