Forgotten patch found in Linux kernel affecting AMD CPU performance

The Linux 6.0 kernel, which is expected to be released next Monday, has adopted a change that addresses performance issues on systems based on AMD Zen processors. The source of the performance drop turned out to be code added 20 years ago to work around a hardware problem in some chipsets. The hardware problem has been fixed for a long time and does not appear in current chipsets, but the old workaround has been forgotten and has become a source of performance degradation on systems based on modern AMD CPUs. New systems with Intel CPUs are not affected by the old workaround, since they access ACPI using a separate intel_idle driver, and not a common processor_idle driver.

A workaround was added to the kernel in March 2002 to block the manifestation of a bug in chipsets related to not properly setting the idle state due to the STPCLK# signal processing delay. To work around the problem in the ACPI implementation, an additional WAIT instruction was added, slowing down the processor so that the chipset had time to enter the idle state. When profiling using IBS (Instruction-Based Sampling) instructions on AMD Zen3 processors, it was revealed that the processor spends a significant amount of time executing a stub, which leads to an incorrect interpretation of the load state on the processor and setting deeper sleep modes (C-State) by the handler cpuidle.

This behavior is reflected in performance degradation under workloads that often alternate between idle and busy states. For example, when using a patch that disables the bypass maneuver, the average tbench test scores increase from 32191 MB/s to 33805 MB/s.

Source: opennet.ru

Add a comment