Re: [ck] Re: [announce] [patch] Voluntary Kernel Preemption Patch

From: Ingo Molnar
Date: Sun Jul 11 2004 - 15:18:15 EST



* Ingo Molnar <mingo@xxxxxxx> wrote:

> it was reporting more accurate latencies, except that there were
> strange spikes of latencies. It turned out that for whatever reason,
> userspace RDTSC is not always reliable on my box (!).
>
> I've attached two fixes against latencytest - one makes rdtsc
> timestamps more reliable, the other one fixes an SMP bug in the kernel
> module (it would lock up under SMP otherwise.).

> static inline unsigned long long int rdtsc(void)
> {
> - unsigned long long int x;
> - __asm__ volatile ("rdtsc" : "=A" (x));
> - return x;
> + unsigned long long int x, y;
> + for (;;) {
> + __asm__ volatile ("rdtsc" : "=A" (x));
> + __asm__ volatile ("rdtsc" : "=A" (y));
> + if (y - x < 1000)
> + return y;
> + }
> }

the same fix should be done to latencytest0.42 too.

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