linux-mips
[Top] [All Lists]

Re: [PATCH] Alchemy: override loops_per_jiffy detection

To: Manuel Lauss <manuel.lauss@googlemail.com>
Subject: Re: [PATCH] Alchemy: override loops_per_jiffy detection
From: Ralf Baechle <ralf@linux-mips.org>
Date: Thu, 27 Aug 2009 11:57:58 +0100
Cc: Linux-MIPS <linux-mips@linux-mips.org>, Manuel Lauss <manuel.lauss@gmail.com>
In-reply-to: <1250957352-14359-1-git-send-email-manuel.lauss@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1250957352-14359-1-git-send-email-manuel.lauss@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.19 (2009-01-05)
On Sat, Aug 22, 2009 at 06:09:12PM +0200, Manuel Lauss wrote:

> The loops_per_jiffy detection in generic calibrate_delay is a bit off
> (by ~0.5% usually); calculate the correct value based on detected core
> clock.  BogoMIPS value will now reflect cpu core clock correctly.

It think this is pretty much solving a non-problem.  The BogoMIPS number
should only be used for various delay functions and the only give a
guarantee for a minimum delay but barely any promise about accuracy of
the delay.  Due to interrupts consuming some CPU time and potencially
producing extra cache misses the measured BogoMIPS value is expected to
be a bit lower than what a naive calculation based on the CPU clock is
predicting; effects that not only impact the calculation of the BogoMIPS
number but also delays based on the BogoMIPS number.

Here's an even easier solution:

#include <linux/jiffies.h>
...
        preset_lpj = <loops_per_jiffie_value>;

Avoid the change to Kconfig that eventually will become messy if other
systems continue along this line.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>