Re: [PATCH] Revert 9fc2105aeaaf56b0cf75296a84702d0f9e64437b to fix pyaudio (and probably more)
From: Nicolas Pitre
Date: Wed Jan 07 2015 - 13:50:48 EST
On Wed, 7 Jan 2015, Catalin Marinas wrote:
> On 5 January 2015 at 04:51, Nicolas Pitre <nicolas.pitre@xxxxxxxxxx> wrote:
> > From: Nicolas Pitre <nicolas.pitre@xxxxxxxxxx>
> > Date: Sun, 4 Jan 2015 22:28:58 -0500
> > Subject: [PATCH] ARM: disentangle timer based delays and bogomips calibration
> >
> > The bogomips value is a pseudo CPU speed value originally used to calibrate
> > loop-based small delays. It is also exported to user space through the
> > /proc filesystem and some user space apps started relying on it.
> >
> > Modern hardware can vary their CPU clock at run time making the bogomips
> > value less reliable for delay purposes. With the advent of high resolution
> > timers, small delays migrated to timer polling loops instead. Strangely
> > enough, the bogomips value calibration became timer based too, making it
> > way more bogus than it already was as a CPU speed representation and people
> > using it via /proc/cpuinfo started complaining.
> >
> > Since it was wrong for user space to rely on a "bogus" mips value to start
> > with, the initial responce from kernel people was to remove it. This broke
> > user space even more as some applications then refused to run altogether.
> > The bogomips export was therefore reinstated in commit 4bf9636c39 ("Revert
> > 'ARM: 7830/1: delay: don't bother reporting bogomips in /proc/cpuinfo'").
> >
> > Because the reported bogomips is orders of magnitude away from the
> > traditionally expected value for a given CPU when timer based delays are
> > in use, and because lumping bogomips and timer based delay loops is rather
> > senseless anyway, let's calibrate bogomips using a CPU loop all the time
> > even when timer based delays are available. Timer based delays don't
> > need any calibration and /proc/cpuinfo will provide somewhat sensible
> > values again.
> >
> > In practice, calls to __delay() will now always use the CPU based loop.
> > Things remain unchanged for udelay() and its derivatives.
>
> I think this makes sense since __delay() expects the number of loops
> as argument rather than a duration scaled by some factor (based on the
> generic timer frequency).
>
> FWIW:
>
> Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>
Thanks.
> Minor comment below:
>
> > unsigned long calibrate_delay_is_known(void)
> > {
> > delay_calibrated = true;
> > - return lpj_fine;
> > +
> > + /* calibrate bogomips even when timer based delays are used */
> > + return 0;
> > }
>
> Do we need to remove delay_calibrated = true as well? We do it further
> down again in calibration_delay_done() .
The logic for delay_calibrated seemed to prevent changes to lpj in case
a better timer source got registered after boot, however commit 6f3d90e5
made that irrelevant. So perhaps delay_calibrated can go now unless
there are concerns about possible races if a better timer gets
registered and called with arguments for the previous one or the like.
In which case I think such a change would be best isolated in a separate
patch.
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/