Re: [PATCH] "volatile considered harmful" document

2007-05-16 Thread Thomas De Schampheleire
On 5/9/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: +CREDITS +--- + +Original impetus and research by Randy Dunlap +Written by Jonathan Corbet +Improvements via coments from Satyam Sharma Johannes Stezenbach Just a small spelling mistake: coments should be comments. - To unsubscribe

Re: [PATCH] volatile considered harmful document

2007-05-16 Thread Thomas De Schampheleire
On 5/9/07, Jonathan Corbet [EMAIL PROTECTED] wrote: +CREDITS +--- + +Original impetus and research by Randy Dunlap +Written by Jonathan Corbet +Improvements via coments from Satyam Sharma Johannes Stezenbach Just a small spelling mistake: coments should be comments. - To unsubscribe

Re: [PATCH] "volatile considered harmful" document

2007-05-14 Thread Bill Davidsen
Jeff Garzik wrote: On Sun, May 13, 2007 at 07:26:13PM -0400, Bill Davidsen wrote: Krzysztof Halasa wrote: Robert Hancock <[EMAIL PROTECTED]> writes: You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be

Re: [PATCH] volatile considered harmful document

2007-05-14 Thread Bill Davidsen
Jeff Garzik wrote: On Sun, May 13, 2007 at 07:26:13PM -0400, Bill Davidsen wrote: Krzysztof Halasa wrote: Robert Hancock [EMAIL PROTECTED] writes: You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be much

Re: [PATCH] "volatile considered harmful" document

2007-05-13 Thread Jeff Garzik
On Sun, May 13, 2007 at 07:26:13PM -0400, Bill Davidsen wrote: > Krzysztof Halasa wrote: > >Robert Hancock <[EMAIL PROTECTED]> writes: > >>You don't need volatile in that case, rmb() can be used. > >rmb() invalidates all compiler assumptions, it can be much slower. It does not invalidate /all/

Re: [PATCH] "volatile considered harmful" document

2007-05-13 Thread Bill Davidsen
Krzysztof Halasa wrote: Robert Hancock <[EMAIL PROTECTED]> writes: You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be much slower. Yes, why would you use rmb() when a read of a volatile generates optimal code? -- bill

Re: [PATCH] "volatile considered harmful" document

2007-05-13 Thread Krzysztof Halasa
Robert Hancock <[EMAIL PROTECTED]> writes: > You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be much slower. -- Krzysztof Halasa - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to

Re: [PATCH] volatile considered harmful document

2007-05-13 Thread Krzysztof Halasa
Robert Hancock [EMAIL PROTECTED] writes: You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be much slower. -- Krzysztof Halasa - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL

Re: [PATCH] volatile considered harmful document

2007-05-13 Thread Bill Davidsen
Krzysztof Halasa wrote: Robert Hancock [EMAIL PROTECTED] writes: You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be much slower. Yes, why would you use rmb() when a read of a volatile generates optimal code? -- bill

Re: [PATCH] volatile considered harmful document

2007-05-13 Thread Jeff Garzik
On Sun, May 13, 2007 at 07:26:13PM -0400, Bill Davidsen wrote: Krzysztof Halasa wrote: Robert Hancock [EMAIL PROTECTED] writes: You don't need volatile in that case, rmb() can be used. rmb() invalidates all compiler assumptions, it can be much slower. It does not invalidate /all/

Re: [PATCH] "volatile considered harmful" document

2007-05-12 Thread Robert Hancock
Bill Davidsen wrote: Jonathan Corbet wrote: +There are still a few rare situations where volatile makes sense in the +kernel: + + - The above-mentioned accessor functions might use volatile on +architectures where direct I/O memory access does work. Essentially, +each accessor call

Re: [PATCH] volatile considered harmful document

2007-05-12 Thread Robert Hancock
Bill Davidsen wrote: Jonathan Corbet wrote: +There are still a few rare situations where volatile makes sense in the +kernel: + + - The above-mentioned accessor functions might use volatile on +architectures where direct I/O memory access does work. Essentially, +each accessor call

Re: [PATCH] "volatile considered harmful" document

2007-05-10 Thread Alan Cox
> In Ethernet drivers, for example, it is common for the network card to > maintain a pointer in host memory the the latest descriptor written; you > will generally have a loop of the form: > > while ((this_pointer = *pointer_ptr) > my_last_pointer) { > for (pkt =

Re: [PATCH] "volatile considered harmful" document

2007-05-10 Thread Bill Davidsen
Jonathan Corbet wrote: +There are still a few rare situations where volatile makes sense in the +kernel: + + - The above-mentioned accessor functions might use volatile on +architectures where direct I/O memory access does work. Essentially, +each accessor call becomes a little

Re: [PATCH] "volatile considered harmful" document

2007-05-10 Thread H. Peter Anvin
Jonathan Corbet wrote: > OK, here's an updated version of the volatile document - as a plain text > file this time. It drops a new file in Documentation/, but might it be > better as an addition to CodingStyle? > > Comments welcome, I have found one use of volatile which I consider legitimate:

Re: [PATCH] "volatile considered harmful" document

2007-05-10 Thread Giacomo A. Catenazzi
Jonathan Corbet wrote: +The volatile storage class was originally meant for memory-mapped I/O +registers. Within the kernel, register accesses, too, should be protected I don't think it deserves to be added in documentation, but just for reference: in userspace "volatile" is needed in signals

Re: [PATCH] volatile considered harmful document

2007-05-10 Thread Giacomo A. Catenazzi
Jonathan Corbet wrote: +The volatile storage class was originally meant for memory-mapped I/O +registers. Within the kernel, register accesses, too, should be protected I don't think it deserves to be added in documentation, but just for reference: in userspace volatile is needed in signals

Re: [PATCH] volatile considered harmful document

2007-05-10 Thread H. Peter Anvin
Jonathan Corbet wrote: OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? Comments welcome, I have found one use of volatile which I consider legitimate:

Re: [PATCH] volatile considered harmful document

2007-05-10 Thread Bill Davidsen
Jonathan Corbet wrote: +There are still a few rare situations where volatile makes sense in the +kernel: + + - The above-mentioned accessor functions might use volatile on +architectures where direct I/O memory access does work. Essentially, +each accessor call becomes a little

Re: [PATCH] volatile considered harmful document

2007-05-10 Thread Alan Cox
In Ethernet drivers, for example, it is common for the network card to maintain a pointer in host memory the the latest descriptor written; you will generally have a loop of the form: while ((this_pointer = *pointer_ptr) my_last_pointer) { for (pkt = my_last_pointer;

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Satyam Sharma
On 5/10/07, Jesper Juhl <[EMAIL PROTECTED]> wrote: On 10/05/07, Satyam Sharma <[EMAIL PROTECTED]> wrote: > On 5/10/07, Jesper Juhl <[EMAIL PROTECTED]> wrote: > > [snip] > > you write: "... that the variable could be changed outside of the > > current thread of execution ..." > > > > I suggest:

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Jesper Juhl
On 10/05/07, Satyam Sharma <[EMAIL PROTECTED]> wrote: On 5/10/07, Jesper Juhl <[EMAIL PROTECTED]> wrote: > On 09/05/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: > > +"the new C book") has the following to say about the volatile keyword: > > + > > + The purpose of volatile is to force

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Scott Preece
On 5/9/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? ... --- I think the size of this file is OK as a

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Heikki Orsila
Imo, the best style to relay information is by directly stating facts. I'm going to try to suggest some improvements on this.. On Wed, May 09, 2007 at 03:05:44PM -0600, Jonathan Corbet wrote: > Andrew Morton recently called out[1] use of volatile in a > +submitted patch, saying: > + > + The

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Satyam Sharma
On 5/10/07, Jesper Juhl <[EMAIL PROTECTED]> wrote: On 09/05/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: > OK, here's an updated version of the volatile document - as a plain text > file this time. It drops a new file in Documentation/, but might it be > better as an addition to CodingStyle?

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Randy Dunlap
Heikki Orsila wrote: Imo, the best style to relay information is by directly stating facts. I'm going to try to suggest some improvements on this.. On Wed, May 09, 2007 at 03:05:44PM -0600, Jonathan Corbet wrote: Andrew Morton recently called out[1] use of volatile in a +submitted patch,

Re: [PATCH] "volatile considered harmful" document

2007-05-09 Thread Jesper Juhl
On 09/05/07, Jonathan Corbet <[EMAIL PROTECTED]> wrote: OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? IMHO this is better as a sepperate document rather than

[PATCH] "volatile considered harmful" document

2007-05-09 Thread Jonathan Corbet
OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? Comments welcome, jon Tell kernel developers why they shouldn't use volatile. Signed-off-by: Jonathan Corbet

[PATCH] volatile considered harmful document

2007-05-09 Thread Jonathan Corbet
OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? Comments welcome, jon Tell kernel developers why they shouldn't use volatile. Signed-off-by: Jonathan Corbet

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Jesper Juhl
On 09/05/07, Jonathan Corbet [EMAIL PROTECTED] wrote: OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? IMHO this is better as a sepperate document rather than

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Randy Dunlap
Heikki Orsila wrote: Imo, the best style to relay information is by directly stating facts. I'm going to try to suggest some improvements on this.. On Wed, May 09, 2007 at 03:05:44PM -0600, Jonathan Corbet wrote: Andrew Morton recently called out[1] use of volatile in a +submitted patch,

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Satyam Sharma
On 5/10/07, Jesper Juhl [EMAIL PROTECTED] wrote: On 09/05/07, Jonathan Corbet [EMAIL PROTECTED] wrote: OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? IMHO

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Scott Preece
On 5/9/07, Jonathan Corbet [EMAIL PROTECTED] wrote: OK, here's an updated version of the volatile document - as a plain text file this time. It drops a new file in Documentation/, but might it be better as an addition to CodingStyle? ... --- I think the size of this file is OK as a separate

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Heikki Orsila
Imo, the best style to relay information is by directly stating facts. I'm going to try to suggest some improvements on this.. On Wed, May 09, 2007 at 03:05:44PM -0600, Jonathan Corbet wrote: Andrew Morton recently called out[1] use of volatile in a +submitted patch, saying: + + The

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Jesper Juhl
On 10/05/07, Satyam Sharma [EMAIL PROTECTED] wrote: On 5/10/07, Jesper Juhl [EMAIL PROTECTED] wrote: On 09/05/07, Jonathan Corbet [EMAIL PROTECTED] wrote: snip +the new C book) has the following to say about the volatile keyword: + + The purpose of volatile is to force an

Re: [PATCH] volatile considered harmful document

2007-05-09 Thread Satyam Sharma
On 5/10/07, Jesper Juhl [EMAIL PROTECTED] wrote: On 10/05/07, Satyam Sharma [EMAIL PROTECTED] wrote: On 5/10/07, Jesper Juhl [EMAIL PROTECTED] wrote: [snip] you write: ... that the variable could be changed outside of the current thread of execution ... I suggest: ... that the