lkml.org 
[lkml]   [1999]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] __volatile__ needed in get_cycles()?
On Tue, 30 Mar 1999, Andrea Arcangeli wrote:

>>Yes, I like the above, I did not know you can do
>>
>>__asm__ __volatile__("": :);
>>
>>to stop compiler from re-ordering things (because I never looked at wmb()
>>macro). (and I like the "pseudo-smiley" at the end :).
>
>Infact you can't do that (thanks to MikeG for make me noticing this) ;).
>It's been my fault. While I thought that the C compiler shouldn't look
>throught the contents of the asm (""), it seems he is optimizing it away
>(too much smart ;) even if it's an "nop" and not a "".

Well as Horst pointed out to me the C compiler shouldn't really optimize
it away! It looks like a C compiler bug. (I know it's offtopic but I post
it here too because maybe somebody read my previous email).

We may want to add some asm-volatile-nop somewhere for example between a
__sti/__cli pair to allow some irq to run in the meantime.

And the point is that the compiler shouldn't really look inside the asm
string at all as I thought in first place developing the code (and as
Horst pointed out to me now).

If somebody need a testcase ask to MikeG ;).

Andrea Arcangeli


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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