Messages in this thread | | | Date | Wed, 31 Mar 1999 16:54:02 +0200 (CEST) | From | Andrea Arcangeli <> | Subject | Re: [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/
| |