[going OFF TOPIC] Re: do_fast_gettimeoffset oops explained (6x86MX Bug) (fwd)

Rafael R. Reilova (rreilova@ececs.uc.edu)
Thu, 14 May 1998 22:23:33 -0500 (EST)


Hi André, Phil, kernel hackers,

On Tue, 12 May 1998, André Derrick Balsa wrote:

> Rafael R. Reilova wrote:
> >
> ...
> > I have what I think is a pretty recent 6x86MX-PR200 (don't feel like
> > taking the case/CPU-fan off now to check mftr date), did a while ago
> >
> > # set6x86 -p 0xc2 -s 0x08
> >
> > and I'm sure the CPU been idle for quite so time while I read the
> > linux-kernel list. ;-)
> > So far no Opses. Is there a way to check if this
> > bug/feature has been fixed? or, if the CPU is actually doing
> > suspend-on-halt?
>
> You can check that suspend-on-halt is turned on by using the utility to
> read the 6x86 registers, included in the set6x86 version 1.5 package.
>
> You can check that the TSC is being stopped/restarted by taking TSC
> readings at 1 second intervals on an idle machine.
>
<snip>

Thanks you all for your replies. I tried your suggestions (see code at
end), and it does look like the TSC is slowing/stopping, but is hard to
tell if its stopping completely (see included output). I have yet to
receive a kernel Ops and my uptime is two days with the suspend-on-halt
enabled (probably I just been lucky so far).

Is the TSC supposed to count at the full clock rate all the time? Will
not doing so screw up the kernel? If the TSC is stopping then Cyrix docs
are completely wrong. They actually state the exact opposite.

Just a though, if the TSC stopping/slowing is such a bad thing what
happens when a APM bios/mobo slows down the system clock. Crashes would
also happen to Intel too, if the BIOS goes as far as stopping the system
clock. Yet, this doesn't happen, what am I missing?

Curious/brave Cyrix users can try the following program. Of course, I
take no responsability of what may become of you computer afterwards.

BTW, suspending the CPU is a Good Thing, iff it doesn't break anything.

-------------------------------------------
/* program to test the TSC bug on Cyrix 6x86 and 6x86MX */
#include <stdio.h>
#include <unistd.h>
#if (__GNUC__ == 2)
#include <sys/perm.h>
#endif
#include <asm/io.h>

/* asm macro to read the tsc */
#define rdtsc(LSB, MSB) asm("rdtsc" : "=a" (LSB), "=d" (MSB) )

/* define to test suspend-on-halt, needs root perms */
#define SUSP_OHALT 1

void loop_test(int times)
{
unsigned long msb, lsb, prev;

rdtsc(prev, msb);
for (; times; times--) {
sleep(1);
rdtsc(lsb, msb);
printf("%lu cycles in 1 sec.\n", lsb - prev);
prev = lsb;
}
}

int main()
{
#ifdef SUSP_OHALT
char data;

if (ioperm(0x22, 2, 1) != 0)
exit(1);

/* enable suspend on halt */
outb(0xc2, 0x22);
data = inb(0x23);
outb(0xc2, 0x22);
outb(data | 8, 0x23);
loop_test(5);

/* disable suspend on halt */
outb(0xc2, 0x22);
data = inb(0x23);
outb(0xc2, 0x22);
outb(data & ~8, 0x23);
#endif

loop_test(5);
exit(0);
}

------------------------------
Sample output

390413 cycles in 1 sec. <- with suspend on halt enabled
459959 cycles in 1 sec.
430947 cycles in 1 sec.
455201 cycles in 1 sec.
579859 cycles in 1 sec.
151261875 cycles in 1 sec. <- normal operation (~150MHz)
151502457 cycles in 1 sec.
151502139 cycles in 1 sec.
151502479 cycles in 1 sec.
151502037 cycles in 1 sec.

Regards,

--
Rafael

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu