All of lore.kernel.org
 help / color / mirror / Atom feed
* Stupid question regarding bogomips and udelay()
@ 2016-08-01  5:36 Aleksander Alekseev
  2016-08-01  9:47 ` François
  0 siblings, 1 reply; 4+ messages in thread
From: Aleksander Alekseev @ 2016-08-01  5:36 UTC (permalink / raw)
  To: kernelnewbies

Hello

Currently I'm reading Linux Kernel Development, 3rd Edition by Robert
Love. Chapter 11 describes timers and udelay() procedure in
particular. According to the book (if I didn't get anything wrong):

* bogomips value (see `cat /proc/cpuinfo`) is determined only once
  during system boot
* udelay() is implemented as busy loop where number of loops is
  calculated based on bogomips value [1][2]
* udelay() guarantees that delay will be _at_least_ given number of
  usecs

It's my understanding that it shouldn't work. CPU frequency actually
changes manually (see cpufrequtils) and/or automatically depending for
instance on laptop's current battery charge. There is also such a nasty
thing as Intel Turbo Boost. In other words actual MIPS could be higher
or lower than measured MIPS. So udealy() can't guarantee anything.

Clearly I don't understand something. Could you please explain why
udelay() supposed to work?

[1]
https://github.com/torvalds/linux/blob/master/arch/x86/lib/delay.c#L171
[2]
https://github.com/torvalds/linux/blob/master/include/asm-generic/delay.h#L19

-- 
Best regards,
Aleksander Alekseev

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-03  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-01  5:36 Stupid question regarding bogomips and udelay() Aleksander Alekseev
2016-08-01  9:47 ` François
2016-08-02  8:27   ` Aleksander Alekseev
2016-08-03  1:20     ` Daniel.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.