pages tagged x86Thadeu Lima de Souza Cascardohttps://cascardo.eti.br/tags/x86/Thadeu Lima de Souza Cascardoikiwiki2019-03-03T12:32:48ZStable TSC on X200https://cascardo.eti.br/blog/Stable_TSC_on_X200/2019-03-03T12:32:48Z2019-03-03T12:32:48Z
<p>I got a Thinkpad X200 running Libreboot. It uses an Intel CPU that has a
TSC (Time Stamp Counter), which allows software to count the passage of
time by the number of cycles. It's a 64-bit counter that used to count
the number of CPU cycles. With CPUs changing clocks to save power, new
CPUs (more than a decade old as shown by my X200) support a constant TSC
that runs under a different clock whose tick duration is constant. This
is supported by the X200 processor I have, and Linux will show it as
constant_tsc on /proc/cpuinfo.</p>
<p>However, Linux won't use the TSC as its clock source if it's marked
unstable, and it is by idle drivers in certain circumstances. The idle
driver changes CPU power states and that may stop the TSC from ticking,
unless the processor has an Invariant TSC, what Linux calls nonstop_tsc
(at /proc/cpuinfo). That is not the case of my processor, so the idle
drivers will mark the TSC as unstable unless they are not loaded or
won't change states.</p>
<p>In order to do the latter, the ACPI driver (the one that ends up being
used because the intel_idle does not support my processor), one needs to
add processor.max_cstate=0 to the command line. That will likely save
less power, which will cause the X200 to consume battery power faster.
But for some of the experiments I have been running with KVM and the
TSC, that is a trade-off I need to pay.</p>