Messages in this thread |  | | Date | Wed, 15 May 1996 08:41:24 -0700 (PDT) | From | Simon Shapiro <> | Subject | Re: 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
|  |