Re: 2.2.0pre1 OOPS on boot.

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Thu, 31 Dec 1998 11:16:36 +0100 (CET)


>
> > The above is essentially what we have now, but I added a "i486+" entry
> > which is apparently what you were looking for. Ok?
>
> That should cover all but the buggy tsc's - seperate patch anyway. Yep
> sounds fine. I've also got the run time modified do_gettimeofday working
> now.
>
> It does the follwoing
>
> do_gettimeofday() is the rdtsc code in full, inlining the asm core
>
> do_slowgettimeoffset() is the slow one in full, inlining the asm core
>
>
> During boot up if you have no tsc or if the tsc is know buggy the
> following is executed
>
> /*
> * The extra jump has basically no measurable cost compared to all
> * the I/O cycles we are about to do if its a slow timer
> */
>
> static void have_no_tsc(void)
>
> unsigned char *x=(unsigned char *)do_gettimeofday();
> u32 data=(u32)do_slow_gettimeofday; /* Aim at */
> data-=(u32)do_gettimeofday; /* We are here */
> data-=2; /* End relative */
>
> *x++=0xEB; /* JMP relative imm8 */
> *x++=(u8)data; /* imm8 */
> }

Even the get_cycles case is easily fixed up during runtime.
Currently, when get_cycles is used only once in the kernel, it can be done
e.g. with:

static inline cycles_t get_cycles (void)
{
unsigned long eax, edx;

__asm__(".global patch_rdtsc; patch_rdtsc: rdtsc":"=a" (eax), "=d" (edx));
return eax;
}

...

static void have_no_tsc(void)
{
extern unsigned char patch_rdtsc[];

/* Alans hacks as above go here... */

patch_rdtsc[0] = 0x31; patch_rdtsc[1] = 0xc0; /* xorl %eax,%eax */
}

but btfixup is able to do such games more generically.
I've it almost done for the PAGE_OFFSET case, just need to give it some
testing.
Generally, I think it is much better to have as few kernels as possible.
And currently, if one compiles CONFIG_I386 (shouldn't it be
named Generic instead of i386?), it won't use rdtsc eventhough your machine
has it. So poor distribution makers should ship at least 10 different
kernels? Bleech.

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.1.130 on a sparc64 machine (3958.37 BogoMips)
___________________________________________________________________

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