AMD has come a long way since 2002, but the Linux kernel still treats modern Threadrippers like Athlon-era systems — at least in one potentially slowdown-causing respect.
AMD engineer Prateek Nayak recently filed a patch for the inactive drivers of Linux processors that would “skip dummy waits for processors based on the Zen microarchitecture”. When ACPI support was added to the Linux kernel in 2002 – written by Andy Grover, committed by Linus Torvalds – it included a “dummy wait on”. The system was essentially reading data for no other purpose than to delay the next instruction until the CPU could completely stop with the STPCLK# command. This provided some power savings and compatibility during the early days of ACPI implementation when some chipsets wouldn’t go to an idle state when you’d expect them to.
But current Zen-based AMD chips don’t need this workaround, and, as Nayak writes, it hurts them, at least on specific workloads on Linux. Instruction-based sampling (IBS) testing shows that “a significant amount of time is spent in the dummy operation, which is erroneously counted as C-State residency.” Seeing all this dummy work with little effort, the CPU can push into a deeper, slower C-State, taking the CPU longer to “wake up,” especially on tasks that require a lot of switching between busy and busy. inactive states.
Nayak ran tests in tbench on a dual-socket Zen3 system against the baseline Linux kernel, a kernel with the C2 state completely disabled, and a kernel with the dummy wait operation patched. Its patched version saw a 1390 percent increase in minimum MB/s throughput and a 51 percent increase in average MB/s over the base kernel, often just less than C2 completely disabled.
Intel systems have avoided AMD’s legacy curse, as they’ve been using an MWAIT-based system for at least a decade, according to the Phoronix blog. That led to an urgent patch submitted by Dave Hansen of Intel. His solution was to limit “dummy wait” to Intel systems, where it would not affect “remotely modern Intel systems”, and add comments to the inactive kernel drivers describing what is happening – and encourage those who read to “consider moving your system to a more modern stationary mechanism.”
If an urgent patch is submitted this week that removes or limits “dummy wait”, it could likely fix the Linux 6.0 kernel, which Torvalds expects to ship next week.