3 ms·
This post has a confused notion of why the TSC isn't used. It has nothing to do with integration with NTP -- it's because the kernel thinks the TSC doesn't wor
by amluto 9y ago
This post has a confused notion of why the TSC isn't used. It has nothing to do with integration with NTP -- it's because the kernel thinks the TSC doesn't work right on the machine in question. The kernel logs should explain why. Also, on some hypervisors, there are TSC problems, but the situation is slowly improving.
Also:
> The second value is the nanoseconds time, relative to the last second, shifted left by gtod->shift, Or, rather, it the time measured in some units, which becomes the nanosecond time when shifted right by gtod->shift, which, in our case, is 25. This is very high precision. One nanosecond divided by 225 is about 30 attoseconds. Perhaps, Linux kernel designers looked far ahead, anticipating the future when we’ll need such accuracy for our time measurement.
That's not what's going on. This is straightforward fixed point arithmetic, where the point just happens to be variable.
- Const-me 9y ago> why the TSC isn't used Because on most modern CPUs, clock frequency is extremely unstable: Turbo Boost, SpeedStep, Cool'n'Quiet, etc. These features make TSC not suitable for time measures.
- bitcharmer 9y agoPlease check for what features like constant_tsc or nonstop_tsc are for before spreading misinformation
- Const-me 9y agoThat thing is intel-only, or at least Linux kernel thinks so: https://github.com/torvalds/linux/blob/master/arch/x86/kernel/tsc.c https://github.com/torvalds/linux/blob/master/arch/x86/kerne... And even on Intel, TSC is not reliable: https://lwn.net/Articles/388286/ https://lwn.net/Articles/388286/
- makomk 9y agoAMD CPUs have supported constant_tsc and nonstop_tsc since the Phenom era too.
- duskwuff 9y agoThere have also been some multi-socket configurations where TSC will gradually become desynchronized across sockets.
- yjftsjthsd-h 9y ago> intel-only So... >99% of servers and the vast majority of desktops?
- otterley 9y agoThat lkml thread was back in 2010, before invariant TSC was a thing.
- fulafel 9y agoOn modern CPUs the tsc does not count CPU cycles.
- loeg 9y agoThis is covered in the fine article.