Linux 5.8 Supporting Intel TPAUSE Power-Optimized Delays, TSC Fix When Overclocking
TPAUSE is the new Intel instruction for supporting lightweight power/performance optimized and improved power/performance states for sleeping until the timestamp counter (TSC) has reached a desired value. This new instruction with Intel's Tremont architecture will now be used by Linux 5.8+ on supported CPUs for an optimized power state while waiting on a delay event.
This Timed Pause (TPAUSE) instruction was outlined in more detail last month for making use of it where supported for more power efficient delays. That code outlined there has now been sent in for Linux 5.8 as part of the x86/timers update.
Intel low-power Tremont-based systems with the TPAUSE instruction initially include Lakefield mobile processors and Snow Ridge server/network processors.
The x86/timers changes have this support for TPAUSE delays as well as a new tsc_early_khz= command line parameter. The tsc_early_khz feature can be used for when Linux is reporting an incorrect frequency for overclocked processors. For systems relying upon the CPUID 16h bit for the processor information frequency leaf, the wrong value for the CPU frequency can be reported and causing the timestamp counter (TSC) calibration to fail.
The tsc_early_khz patch explained, "Changing base clock frequency directly impacts TSC Hz but not CPUID.16h value. An overclocked CPU supporting CPUID.16h and with partial CPUID.15h support will set TSC Hz according to "best guess" given by CPUID.16h relying on tsc_refine_calibration_work to give better numbers later. tsc_refine_calibration_work will refuse to do its work when the outcome is off the early TSC Hz value by more than 1% which is certain to happen on an overclocked system. Fix this by adding a tsc_early_khz command line parameter that makes the kernel skip early TSC calibration and use the given value instead. This allows the user to provide the expected TSC frequency that is closer to reality than the one reported by the hardware, enabling tsc_refine_calibration_work to do meaningful error checking."
This Timed Pause (TPAUSE) instruction was outlined in more detail last month for making use of it where supported for more power efficient delays. That code outlined there has now been sent in for Linux 5.8 as part of the x86/timers update.
Intel low-power Tremont-based systems with the TPAUSE instruction initially include Lakefield mobile processors and Snow Ridge server/network processors.
The x86/timers changes have this support for TPAUSE delays as well as a new tsc_early_khz= command line parameter. The tsc_early_khz feature can be used for when Linux is reporting an incorrect frequency for overclocked processors. For systems relying upon the CPUID 16h bit for the processor information frequency leaf, the wrong value for the CPU frequency can be reported and causing the timestamp counter (TSC) calibration to fail.
The tsc_early_khz patch explained, "Changing base clock frequency directly impacts TSC Hz but not CPUID.16h value. An overclocked CPU supporting CPUID.16h and with partial CPUID.15h support will set TSC Hz according to "best guess" given by CPUID.16h relying on tsc_refine_calibration_work to give better numbers later. tsc_refine_calibration_work will refuse to do its work when the outcome is off the early TSC Hz value by more than 1% which is certain to happen on an overclocked system. Fix this by adding a tsc_early_khz command line parameter that makes the kernel skip early TSC calibration and use the given value instead. This allows the user to provide the expected TSC frequency that is closer to reality than the one reported by the hardware, enabling tsc_refine_calibration_work to do meaningful error checking."
Add A Comment