Re: [PATCH] Intel clock speed detection

Phil Brutsche (pbrutsch@creighton.edu)
Tue, 23 Dec 1997 22:58:39 -0600 (CST)


On another note, I just looked at your patch. It uses the rdtsc
instruction; this instruction does not exist on anything less than a
Pentium. I'm not sure what the kernel would do on '486 or '386, but it
would'nt be pretty. A better solution for this would be to time the bsf
instruction on those chips. I have source in C and assembly if you need
help.

On Tue, 23 Dec 1997, Nicholas J. Leon wrote:

> Fellow kernel enthusiasts -
>
> I've been playing with routines to determine actual cpu speed on Intel
> chips; hoping to replace the "75+" notation with something accurate.
>
> Using some assembly routines from a patch I acquired a few months ago,
> whose author I have completely forgotten, I've made some preliminary
> patches against 2.1.75. Here is what I did:
>
> . added a field called "x86_mhz" to cpuinfo_x86
> . added a function called "get_cpu_speed" to setup.c
> . calling get_cpu_speed from identify_cpu() in setup.c
> . added reporting of the speed to print_cpu_info() and get_cpuinfo()
> in setup.c
>
> Here are the problems I know I haven't addressed:
>
> . does my mhz detection routine work reliably (ie, at all)
> with all non-intel cpu's?
> . what about SMP machines?
> . slight variation of reported mhz (132 vs 133)
> . struct cpu_model_info now has redundant elements of "Pentium"
> (since I removed the 60/66, 75+). I'm not sure how these are
> referenced in the first place, so I didn't compact them together
> (as they should be).
>
> The first I am hoping that some people out there will try my patch on
> their AMD and Cyrix systems and let me know. The second, uhhhhh, well,
> I'm over my head with this one. I would certainly appreciate any and
> all help that might come my direction. Regardless of knowledge,
> though, I have no practical way of testing SMP's reaction to my
> patch. So I must rely on others for this.
>
> I know that in the past, Linus has refused to include clock speed
> detecting into the kernel. From what I understand, the original patch
> did the calculations on the fly when you examined /proc/cpuinfo and
> this was the reason for the refusal. My patch doesn't. It calculates
> the rate upon boot and stores the information into
> cpuinfo_x86. Hopefully, this will allow its inclusion into the
> mainstream kernel once all the issues have been taken care of.
>
> Please, take the time and look at what I've done. I know its not
> anything amazing, but since the kernel isn't written in Perl, there's
> not a lot I can contribute :) This, however, might be one of those
> things I _can_ do.
>
> Thank you for your time!
>
> [ patch attached ]
>
>
> ___________________________________________________________________________
>
> simple is elegant nicholas@binary9.net
> ___________________________________________________________________________
>

----------------------------------------------------------------------
Phil Brutsche

"Be of stout heart, Number One. We've handled the Borg. We can
certainly handle Admiral Jellico." - Jean-Luc Picard

----------------------------------------------------------------------