`do_gettimeoffday' broken on i686 SMP

Mark-Andre Hopf (hopf@informatik.uni-rostock.de)
Mon, 18 Jan 1999 23:56:51 +0100 (MET)


Hi,

I have a dual PentiumPro-180 System from IBM. Last December, when
Colin Plumb <colin@nyx.net> was doing his SMP tests on the TSC register,
he stated that my two TSCs differ quite a lot.

Today I encountered something which I believe is a result of this TSC
difference. When I run this program:

#include <stdio.h>
#include <unistd.h>
#include <syscall.h>
#include <sys/time.h>

struct timeval t;

main()
{
t.tv_sec = 0;
while(1) {
int oldsec = t.tv_sec;
// gettimeofday(&t, NULL);
syscall(SYS_gettimeofday, &t, NULL);
if (t.tv_sec<oldsec)
printf("TIME ERROR: %ds\n", oldsec-t.tv_sec);
}
}

I get output. But this must not happen and the time difference is about 23
to 24 seconds.

And when I make these modifications to the kernel

--- linux/arch/i386/kernel/time.c.old Mon Jan 18 22:12:53 1999
+++ linux/arch/i386/kernel/time.c Mon Jan 18 23:40:40 1999
@@ -642,7 +642,7 @@
*/

dodgy_tsc();
-
+#if 0
if (boot_cpu_data.x86_capability & X86_FEATURE_TSC) {
#ifndef do_gettimeoffset
do_gettimeoffset = do_fast_gettimeoffset;
@@ -663,5 +663,6 @@
printk("Detected %ld Hz processor.\n", cpu_hz);
}
}
+#endif
setup_x86_irq(0, &irq0);
}

the problem is gone. Interesting problem isn't it? :)

Mark

+-----------------------------------------------------+----------------------+
| the wizard himself, Mark-André Hopf | Every sufficiently |
| hopf@informatik.uni-rostock.de | developed technology |
| Visit the TOAD GUI Toolkit Project Homepage at | is indistinguishable |
| http://toad.home.pages.de/ | from magic. (A.C.C.) |
+-----------------------------------------------------+----------------------+

-
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/