Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1582965

Re: [PATCH] Add explanation of udelay() inaccuracy

From Pavel Machek <pavel@ucw.cz>
Newsgroups linux.kernel
Subject Re: [PATCH] Add explanation of udelay() inaccuracy
Date 2017-02-16 23:00 +0100
Message-ID <tbCfL-3Pz-15@gated-at.bofh.it> (permalink)
References <t1iV4-Qv-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi!

> +++ b/include/linux/delay.h
> @@ -5,6 +5,17 @@
>   * Copyright (C) 1993 Linus Torvalds
>   *
>   * Delay routines, using a pre-computed "loops_per_jiffy" value.
> + *
> + * Please note that ndelay(), udelay() and mdelay() may return early for
> + * several reasons:
> + *  1. computed loops_per_jiffy too low (due to the time taken to
> + *     execute the timer interrupt.)
> + *  2. cache behaviour affecting the time it takes to execute the
> + *     loop function.
> + *  3. CPU clock rate changes.
> + *

Hmm. Formulated like this, it would mean that udelay(100) can return
in 10usec (because of clock rate changes). No way can drivers work
reliably in that case.

Can we formulate something more useful? We don't want driver writers
to delay 10 times more "just for cpufreq", right?

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] Add explanation of udelay() inaccuracy Pavel Machek <pavel@ucw.cz> - 2017-02-16 23:00 +0100

csiph-web