Re: [PATCH] "volatile considered harmful", take 3

2007-05-17 Thread Satyam Sharma
Hi Bill, On 5/18/07, Bill Davidsen <[EMAIL PROTECTED]> wrote: Satyam Sharma wrote: > *Unfortunately* (the trouble with C itself, is that a *committee* has made > it into ... something ... that it should not have made it into) -- anyway, > unfortunately C took it upon itself to solve a problem

Re: [PATCH] "volatile considered harmful", take 3

2007-05-17 Thread Bill Davidsen
Satyam Sharma wrote: *Unfortunately* (the trouble with C itself, is that a *committee* has made it into ... something ... that it should not have made it into) -- anyway, unfortunately C took it upon itself to solve a problem that it did not have (and does not even bring about) in the first

Re: [PATCH] volatile considered harmful, take 3

2007-05-17 Thread Bill Davidsen
Satyam Sharma wrote: *Unfortunately* (the trouble with C itself, is that a *committee* has made it into ... something ... that it should not have made it into) -- anyway, unfortunately C took it upon itself to solve a problem that it did not have (and does not even bring about) in the first

Re: [PATCH] volatile considered harmful, take 3

2007-05-17 Thread Satyam Sharma
Hi Bill, On 5/18/07, Bill Davidsen [EMAIL PROTECTED] wrote: Satyam Sharma wrote: *Unfortunately* (the trouble with C itself, is that a *committee* has made it into ... something ... that it should not have made it into) -- anyway, unfortunately C took it upon itself to solve a problem that

Re: [PATCH] "volatile considered harmful", take 3

2007-05-13 Thread Satyam Sharma
Hi Bodo, On 5/13/07, Bodo Eggert <[EMAIL PROTECTED]> wrote: Satyam Sharma <[EMAIL PROTECTED]> wrote: > In fact you can't really say the same for > volatile. We already assume the compiler _actually_ took some > pains to stuff meaning into C's (lack of) definition of volatile and > implement it

Re: [PATCH] volatile considered harmful, take 3

2007-05-13 Thread Satyam Sharma
Hi Bodo, On 5/13/07, Bodo Eggert [EMAIL PROTECTED] wrote: Satyam Sharma [EMAIL PROTECTED] wrote: In fact you can't really say the same for volatile. We already assume the compiler _actually_ took some pains to stuff meaning into C's (lack of) definition of volatile and implement it -- but

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Bodo Eggert
Satyam Sharma <[EMAIL PROTECTED]> wrote: > In fact you can't really say the same for > volatile. We already assume the compiler _actually_ took some > pains to stuff meaning into C's (lack of) definition of volatile and > implement it -- but in what sense, nobody knows (the C standard

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Dr. David Alan Gilbert
* H. Peter Anvin ([EMAIL PROTECTED]) wrote: > Satyam Sharma wrote: > > > > Because volatile is ill-defined? Or actually, *undefined* (well, > > implementation-defined is as good as that)? It's *so* _vague_, > > one doesn't _feel_ like using it at all! > > > > Sorry, that's just utter crap.

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread H. Peter Anvin
Stefan Richter wrote: > H. Peter Anvin wrote: > [slightly off topic: GCCisms in Linux kernel] >> It contains *many* constructs that are not defined in, for >> example, C99, and it would in fact be impossible to write the Linux >> kernel using only C99-compliant constructs. > > True. On the other

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Heikki Orsila
On Sat, May 12, 2007 at 09:53:03AM +0200, Stefan Richter wrote: > H. Peter Anvin wrote: > [slightly off topic: GCCisms in Linux kernel] > > It contains *many* constructs that are not defined in, for > > example, C99, and it would in fact be impossible to write the Linux > > kernel using only

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Stefan Richter
H. Peter Anvin wrote: [slightly off topic: GCCisms in Linux kernel] > It contains *many* constructs that are not defined in, for > example, C99, and it would in fact be impossible to write the Linux > kernel using only C99-compliant constructs. True. On the other hand, it is possible to keep

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Jeff Garzik
jimmy bahuleyan wrote: i believe, the doc here is pretty unambiguous regarding the fact that volatile should be avoided. And as Stefan pointed out, anyone who feels the need to use, must surely _know_ what he is doing & hence is in a position t make that decision Honestly, the above quoted

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread jimmy bahuleyan
Stefan Richter wrote: > Satyam Sharma wrote: >> Coming back to the document, we do need to document / find >> consensus on the "preferred" way to do similar business in the >> kernel, and my opinion as far as that is concerned is to shun >> volatile wherever possible (which includes the case

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Satyam Sharma
On 5/12/07, H. Peter Anvin <[EMAIL PROTECTED]> wrote: Satyam Sharma wrote: >> >> Sorry, that's just utter crap. Linux isn't written in some mythical C >> which only exists in standard document, it is written in a particular >> subset of GNU C. "volatile" is well enough defined in that context,

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Stefan Richter
Satyam Sharma wrote: > Coming back to the document, we do need to document / find > consensus on the "preferred" way to do similar business in the > kernel, and my opinion as far as that is concerned is to shun > volatile wherever possible (which includes the case originally > discussed above). I

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread H. Peter Anvin
Satyam Sharma wrote: >> >> Sorry, that's just utter crap. Linux isn't written in some mythical C >> which only exists in standard document, it is written in a particular >> subset of GNU C. "volatile" is well enough defined in that context, it >> is just frequently misused. > > Of course,

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Satyam Sharma
On 5/12/07, H. Peter Anvin <[EMAIL PROTECTED]> wrote: Satyam Sharma wrote: > > Because volatile is ill-defined? Or actually, *undefined* (well, > implementation-defined is as good as that)? It's *so* _vague_, > one doesn't _feel_ like using it at all! > Sorry, that's just utter crap. Linux

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread H. Peter Anvin
Satyam Sharma wrote: > > Because volatile is ill-defined? Or actually, *undefined* (well, > implementation-defined is as good as that)? It's *so* _vague_, > one doesn't _feel_ like using it at all! > Sorry, that's just utter crap. Linux isn't written in some mythical C which only exists in

Re: [PATCH] "volatile considered harmful", take 3

2007-05-12 Thread Satyam Sharma
On 5/12/07, H. Peter Anvin <[EMAIL PROTECTED]> wrote: Satyam Sharma wrote: > >> + - Pointers to data structures in coherent memory which might be >> modified >> +by I/O devices can, sometimes, legitimately be volatile. A ring >> buffer >> +used by a network adapter, where that adapter

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Satyam Sharma
On 5/12/07, H. Peter Anvin [EMAIL PROTECTED] wrote: Satyam Sharma wrote: + - Pointers to data structures in coherent memory which might be modified +by I/O devices can, sometimes, legitimately be volatile. A ring buffer +used by a network adapter, where that adapter changes

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread H. Peter Anvin
Satyam Sharma wrote: Because volatile is ill-defined? Or actually, *undefined* (well, implementation-defined is as good as that)? It's *so* _vague_, one doesn't _feel_ like using it at all! Sorry, that's just utter crap. Linux isn't written in some mythical C which only exists in standard

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Satyam Sharma
On 5/12/07, H. Peter Anvin [EMAIL PROTECTED] wrote: Satyam Sharma wrote: Because volatile is ill-defined? Or actually, *undefined* (well, implementation-defined is as good as that)? It's *so* _vague_, one doesn't _feel_ like using it at all! Sorry, that's just utter crap. Linux isn't

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread H. Peter Anvin
Satyam Sharma wrote: Sorry, that's just utter crap. Linux isn't written in some mythical C which only exists in standard document, it is written in a particular subset of GNU C. volatile is well enough defined in that context, it is just frequently misused. Of course, volatile _is_

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Stefan Richter
Satyam Sharma wrote: Coming back to the document, we do need to document / find consensus on the preferred way to do similar business in the kernel, and my opinion as far as that is concerned is to shun volatile wherever possible (which includes the case originally discussed above). I too

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Satyam Sharma
On 5/12/07, H. Peter Anvin [EMAIL PROTECTED] wrote: Satyam Sharma wrote: Sorry, that's just utter crap. Linux isn't written in some mythical C which only exists in standard document, it is written in a particular subset of GNU C. volatile is well enough defined in that context, it is just

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread jimmy bahuleyan
Stefan Richter wrote: Satyam Sharma wrote: Coming back to the document, we do need to document / find consensus on the preferred way to do similar business in the kernel, and my opinion as far as that is concerned is to shun volatile wherever possible (which includes the case originally

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Jeff Garzik
jimmy bahuleyan wrote: i believe, the doc here is pretty unambiguous regarding the fact that volatile should be avoided. And as Stefan pointed out, anyone who feels the need to use, must surely _know_ what he is doing hence is in a position t make that decision Honestly, the above quoted

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Stefan Richter
H. Peter Anvin wrote: [slightly off topic: GCCisms in Linux kernel] It contains *many* constructs that are not defined in, for example, C99, and it would in fact be impossible to write the Linux kernel using only C99-compliant constructs. True. On the other hand, it is possible to keep large

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Heikki Orsila
On Sat, May 12, 2007 at 09:53:03AM +0200, Stefan Richter wrote: H. Peter Anvin wrote: [slightly off topic: GCCisms in Linux kernel] It contains *many* constructs that are not defined in, for example, C99, and it would in fact be impossible to write the Linux kernel using only C99-compliant

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread H. Peter Anvin
Stefan Richter wrote: H. Peter Anvin wrote: [slightly off topic: GCCisms in Linux kernel] It contains *many* constructs that are not defined in, for example, C99, and it would in fact be impossible to write the Linux kernel using only C99-compliant constructs. True. On the other hand, it

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Dr. David Alan Gilbert
* H. Peter Anvin ([EMAIL PROTECTED]) wrote: Satyam Sharma wrote: Because volatile is ill-defined? Or actually, *undefined* (well, implementation-defined is as good as that)? It's *so* _vague_, one doesn't _feel_ like using it at all! Sorry, that's just utter crap. Linux isn't

Re: [PATCH] volatile considered harmful, take 3

2007-05-12 Thread Bodo Eggert
Satyam Sharma [EMAIL PROTECTED] wrote: In fact you can't really say the same for volatile. We already assume the compiler _actually_ took some pains to stuff meaning into C's (lack of) definition of volatile and implement it -- but in what sense, nobody knows (the C standard

Re: [PATCH] "volatile considered harmful", take 3

2007-05-11 Thread H. Peter Anvin
H. Peter Anvin wrote: > > I don't see why Alan's way is necessarily better; it should work but is > more heavy-handed as it's disabling *all* optimization such as loop > invariants across the barrier. > To expand on this further: the way this probably *should* be handled, Linux-style, is with

Re: [PATCH] "volatile considered harmful", take 3

2007-05-11 Thread H. Peter Anvin
Satyam Sharma wrote: > >> + - Pointers to data structures in coherent memory which might be >> modified >> +by I/O devices can, sometimes, legitimately be volatile. A ring >> buffer >> +used by a network adapter, where that adapter changes pointers to >> +indicate which descriptors

Re: [PATCH] "volatile considered harmful", take 3

2007-05-11 Thread Jeff Garzik
Satyam Sharma wrote: On 5/11/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: + - Pointers to data structures in coherent memory which might be modified +by I/O devices can, sometimes, legitimately be volatile. A ring buffer +used by a network adapter, where that adapter changes

Re: [PATCH] "volatile considered harmful", take 3

2007-05-11 Thread Satyam Sharma
On 5/11/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: Here's another version of the volatile document. Once again, I've tried to address all of the comments. There haven't really been any recent comments addressing the correctness of the document; people have been more concerned with how it's

Re: [PATCH] "volatile considered harmful", take 3

2007-05-11 Thread Jesper Juhl
On 11/05/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: Here's another version of the volatile document. Once again, I've tried to address all of the comments. There haven't really been any recent comments addressing the correctness of the document; people have been more concerned with how

[PATCH] "volatile considered harmful", take 3

2007-05-11 Thread Jonathan Corbet
Here's another version of the volatile document. Once again, I've tried to address all of the comments. There haven't really been any recent comments addressing the correctness of the document; people have been more concerned with how it's expressed. I'm glad to see files in Documentation/ held

[PATCH] volatile considered harmful, take 3

2007-05-11 Thread Jonathan Corbet
Here's another version of the volatile document. Once again, I've tried to address all of the comments. There haven't really been any recent comments addressing the correctness of the document; people have been more concerned with how it's expressed. I'm glad to see files in Documentation/ held

Re: [PATCH] volatile considered harmful, take 3

2007-05-11 Thread Jesper Juhl
On 11/05/07, Jonathan Corbet [EMAIL PROTECTED] wrote: Here's another version of the volatile document. Once again, I've tried to address all of the comments. There haven't really been any recent comments addressing the correctness of the document; people have been more concerned with how it's

Re: [PATCH] volatile considered harmful, take 3

2007-05-11 Thread Satyam Sharma
On 5/11/07, Jonathan Corbet [EMAIL PROTECTED] wrote: Here's another version of the volatile document. Once again, I've tried to address all of the comments. There haven't really been any recent comments addressing the correctness of the document; people have been more concerned with how it's

Re: [PATCH] volatile considered harmful, take 3

2007-05-11 Thread Jeff Garzik
Satyam Sharma wrote: On 5/11/07, Jonathan Corbet [EMAIL PROTECTED] wrote: + - Pointers to data structures in coherent memory which might be modified +by I/O devices can, sometimes, legitimately be volatile. A ring buffer +used by a network adapter, where that adapter changes

Re: [PATCH] volatile considered harmful, take 3

2007-05-11 Thread H. Peter Anvin
Satyam Sharma wrote: + - Pointers to data structures in coherent memory which might be modified +by I/O devices can, sometimes, legitimately be volatile. A ring buffer +used by a network adapter, where that adapter changes pointers to +indicate which descriptors have been

Re: [PATCH] volatile considered harmful, take 3

2007-05-11 Thread H. Peter Anvin
H. Peter Anvin wrote: I don't see why Alan's way is necessarily better; it should work but is more heavy-handed as it's disabling *all* optimization such as loop invariants across the barrier. To expand on this further: the way this probably *should* be handled, Linux-style, is with