Re: volatile magic

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 23 Sep 1997 19:51:48 +0100 (BST)


> A haven't found any cases in the scsi code where reliance on barrier()
> causes the wrong code to be generated, but I can't help but be nervous
> about it. It seems excessively fragile to me.
> I wonder how many other places in the kernel are written the same way?

Most of it. And since gcc 2.6 gcc has been basically right (2.5.8 didnt always
get it right). We don't want to use volatile as that generates sucky code all
over. Instead we prod the compiler into the right code in key places. The
sti/cli and other locks also use these kind of things if you look to ensure
temporaries are written back across interrupt locking