Re: [patch] __volatile__ needed in get_cycles()?

Andrea Arcangeli (andrea@e-mind.com)
Tue, 30 Mar 1999 16:02:52 +0200 (CEST)


On Tue, 30 Mar 1999, Ingo Molnar wrote:

>to have 'exact' get_cycles() we need both the compiler-level barrier, and
>both a pre- and post- rdtsc bus-level barrier, because both preceding and

Are you really sure the post- rdtsc is needed? Sure theorically is needed,
but maybe the CPU isn't so smart as theory.

>--- linux/include/asm-i386/timex.h.orig2 Tue Mar 30 10:50:09 1999
>+++ linux/include/asm-i386/timex.h Tue Mar 30 10:50:49 1999
>@@ -39,7 +39,9 @@
> #else
> unsigned long eax, edx;
>
>+ mb();
> __asm__ __volatile__("rdtsc":"=a" (eax), "=d" (edx));
>+ mb();

mb() will also make the compiler to think that the memory is been modifyed
by the asm while this isn't been true, so this is a bit of overkill
in the overkill ;) according to me.

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/