Re: Wrong bogomips after plugging in AC power

Erik Mouw (erik@it.et.tudelft.nl)
Sat, 30 Oct 1999 23:08:34 +0200 (CEST)


Scott Marlowe wrote:
> On Sat, 30 Oct 1999, Chad Miller wrote:
>
> > On Fri, Oct 29, 1999 at 12:20:32PM -0700, Jeremy Fitzhardinge wrote:
> > > Bogomips calculation is pretty slow and CPU consuming. The basic problem is
> > > that the premise, the CPU always runs at the same rate, is flawed. The
> > > solution is to find some other timebase.
> >
> >
> > I think Jeremy's on the right track. Processor speed is too fickle[1] and
> > bogomip re-calculation too expensive (and ugly) to keep.
>
> No, bogomip calculation is too expensive to do during a running kernel. At
> boot time it doesn't matter one whit what it costs.

Agreed.

> If we know the frequencies the amchine runs at in each mode, it's no big
> deal to find the new bogomips.

Yes, I just grepped through the kernel source, and it looks like we have
to re-adjust loops_per_sec (defined in init/main.c). This would be
enough on the StrongARM SA-1100.

> Then:
>
> Is that something we can find quicker than a full on bogo mips calc? How?

Store the boot-time bogomips value in a separate variable, and each
time the clock frequency changes, recompute the new value and store
it in loops_per_second. The udelay function is small enough to fit in
even the smallest CPU cache, so the scaling would be linear with the
CPU frequency.

> Would laptops need a bogomips.conf file in their /etc directory, or do APM
> and what not have an API that can tell us that on most systems that change
> clock speed? Or is there a super fast and dirty check we can do to "guess"
> from a group of logical speeds which one we're running.

I don't know if APM warns you about the changed processor speed, but if
it does, I'm sure it will vary wildly between computers. A userland program
to inform the kernel would be nice. If APM doesn't tell you, the userland
program will till be able to recompute the processor speed using things
as load average, initial CPU speed, and the time do to spin in a closed
loop.

> If none of those work, could we do a super quick and dirty compute to guess
> what speed we're going? (I.e. do most of these systmes just shut down the
> front side bus, or only the CPU side of it by changing the multiplier?
>
> How expensive is a bogomips calc anyway?

It's fairly expensive (see init/main.c): it's a close loop that just does
a lot of delays to and compares the delay with a reference value.

Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/

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