lkml.org 
[lkml]   [1996]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Is clobber "memory" in include/asm-i386/system.h necessary?

Hi Linus Torvalds; On 07-May-96 you wrote:

...

> "volatile" is _never_ a good idea, even in SMP. You already touched on
> why it's not a good idea: it's unnecessary if we have some locking to
> prevent concurrent accesses.

Except for emmory mapped I/O.

Assume:

int *x; /* Some memory mapped I/O port */

x = SOME_MEMORY_MAPPED_REG;

*x = 1; //* Initialize */

while ( *x )
{
....
}

What will the compiler/optimizer do with this?
The purpose of volatile was to protect such cases, if my memory serves me.

> Now, if we DON'T have locking that prevents concurrent accesses, then we
> have a major bug in the system.

Locks are locks. Not having locks is bad.

> Ergo, using "volatile" means that we have a major bug in the system.

Using volatile as a lock is bad. True enough. But not necessarily bad in
itself. Unless GCC is broken, that is (always a possibility :-).

Sincerely Yours, (Sent on 05/15/96, 08:41:24 by XF-Mail)

Simon Shapiro i-Connect.Net, a Division of iConnect Corp.
Director of Technology 13455 SW Allen Blvd., Suite 140 Beaverton OR 97008
Shimon@i-Connect.Net Voice: 503.677.2900, Emergency: 503.441.1681


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.100 / U:1.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site