Re: [RFC] Improving udelay/ndelay on platforms where that is possible

From: Linus Torvalds
Date: Tue Oct 31 2017 - 12:44:26 EST


On Tue, Oct 31, 2017 at 9:15 AM, Marc Gonzalez
<marc_gonzalez@xxxxxxxxxxxxxxxx> wrote:
>
> On arm32, it is possible to set up udelay() to be clock-based.

I'm not sure why this is discussed as some kind of generic problem.

Just do what x86-64 already does. We use the TSC, and ndelay() does
the right thing too.

I've not checked precision, but it should be close to the TSC update
frequency. So we're talking tens of megahertz.

Does it work on all PC's? No. It's only half-way reliable on the ones
where the TSC frequency doesn't change. So there are no *guarantees*.

Linus