udelay() broken for SMP cores?

Russell King - ARM Linux linux at arm.linux.org.uk
Wed Apr 21 15:33:05 EDT 2010


On Wed, Apr 21, 2010 at 03:31:03AM -0700, skannan at codeaurora.org wrote:
> > Well, the assumption is that the CPUs will be running at their fastest
> > speed at boot time, and therefore loops_per_jiffy will be calibrated
> > such that we guarantee _at least_ the asked-for delay - which is the
> > only guarantee udelay has.
> 
> Even if the boot assumption is true, cpufreq actively changes the
> loops_per_jiffy value when it changes freq. So, this could still mess up
> the _at least_ guarantee.

Actually, it doesn't on SMP - if you build the kernel with SMP enabled,
the code which fiddles with loops_per_jiffy is disabled.  See the
#ifndef wrapping around adjust_jiffies() in drivers/cpufreq/cpufreq.c.

So, on SMP with cpufreq, the global loops_per_jiffy is a fixed value.
Provided it was calibrated with the CPU running at max clock rate,
the guarantee is satisfied for all CPUs in the system.



More information about the linux-arm-kernel mailing list