Linux 4.17 Getting A Fix That May Help AMD Systems Conserve Power When Idling
Written by Michael Larabel in AMD on 29 April 2018 at 12:06 PM EDT. 22 Comments
AMD --
Besides other promising Linux 4.17 power saving improvements, a separate fix was queued today for potentially helping AMD systems conserve power.

An AMD engineer noticed that with the existing Linux kernel code, using the MWAIT instruction is supported and used but on AMD CPUs but does not allow deeper c-states than C1 with current-generation hardware. The MWAIT x86 instruction is used as a hint for letting the processor enter a CPU-specific optimized state.

So with the kernel code up until now, on AMD CPUs it could forgo entering some of the deeper power-saving states. But with this simple patch, that's no longer the case.
Recent AMD systems support using MWAIT for C1 state. However, MWAIT will not allow deeper cstates than C1 on current systems.

play_dead() expects to use the deepest state available. The deepest state available on AMD systems is reached through SystemIO or HALT. If MWAIT is available, it is preferred over the other methods, so the CPU never reaches the deepest possible state.

Don't try to use MWAIT to play_dead() on AMD systems. Instead, use CPUIDLE to enter the deepest state advertised by firmware. If CPUIDLE is not available then fallback to HALT.

The good news is this patch is also copied for the Linux kernel stable series too so should be appearing in the various maintained branches soon rather than having to wait for Linux 4.17.

It will be interesting to see the impact on power-savings for AMD Zen systems as a result of this change. The pull request of the x86 patches today notes it does "prevent excessive power consumption" but does not provide any specifics, but I'll be testing it shortly on Linux Git.

About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Related AMD News
Popular News This Week