lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.11.1501071332310.1322@knanqh.ubzr>
Date:	Wed, 7 Jan 2015 13:50:40 -0500 (EST)
From:	Nicolas Pitre <nicolas.pitre@...aro.org>
To:	Catalin Marinas <catalin.marinas@....com>
cc:	Russell King - ARM Linux <linux@....linux.org.uk>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Pavel Machek <pavel@....cz>,
	Marc Zyngier <marc.zyngier@....com>,
	kernel list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Revert 9fc2105aeaaf56b0cf75296a84702d0f9e64437b to fix
 pyaudio (and probably more)

On Wed, 7 Jan 2015, Catalin Marinas wrote:

> On 5 January 2015 at 04:51, Nicolas Pitre <nicolas.pitre@...aro.org> wrote:
> > From: Nicolas Pitre <nicolas.pitre@...aro.org>
> > 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@....com>

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ