Stupid question regarding bogomips and udelay()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux