Re: udelay function delays the wrong time interval inmultiprocessor system, if ARCH_HAS_READ_CURRENT_TIMER is notdefined and on current timer is used.

From: Russell King - ARM Linux
Date: Mon Mar 18 2013 - 11:25:42 EST


On Mon, Mar 18, 2013 at 10:40:56PM +0800, chpoph wrote:
> On Sun, Mar 17, 2013 at 08:05:43PM +0000, Will Deacon wrote:
> >Do you actually have an ARM platform that can scale the CPU frequencies
> independently?
>
> Yes, my smart phone use Qualcomm's 8x25 and 8064 platform, which can
> scale the CPU frequencies independently. I test the delay loop, the
> phone can't get accurate delayed time intervals.

That is expected. udelay() is only approximate. Sometimes, it will give
you a slightly shorter delay than asked for, or if preempted, it can give
you a much longer delay - because it has no idea how long it has been
preempted for.

This is why in a SMP system it is much better to use a timer-based udelay()
implementation which is more independent of these effects.
--
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/