Intel has published a new patch series (opens in new tab) for its Linux drivers that promise to improve the performance of its hybrid Alder Lake processors by optimizing usage of (P)erformance and (E)fficiency cores.
When Intel released its 12th Generation Core 'Alder Lake' processors earlier this year, it quickly turned out that the new CPUs perform better under Windows rather than under Linux. Unlike Windows 11, Linux does not have proper support for Intel's Thread Director technology based on the Enhanced Hardware Feedback Interface (HFI), which enables the OS to utilize high-performance Golden Cove and energy-efficient Gracemont cores properly.
At present, the Linux kernel decides when to use P or E cores using the ITMT/Turbo Boost Max 3.0 driver that relies on the information exposed by the firmware, reports Phoronix (opens in new tab). Essentially, this means that under Linux, the OS in many cases prefers the fastest cores (i.e., Golden Coves at high clocks) and underutilizes energy-efficient cores.
By contrast, HFI communicates numeric performance and numeric power efficiency capabilities of each CPU core in a 0 – 255 range to the OS in real-time. Suppose either the performance or energy capabilities efficiency of a CPU is 0. In that case, the hardware dynamically adapts to the current instruction mix and recommends not scheduling any tasks on such core for performance, energy efficiency, or thermal reasons, respectively.
Here is how Intel describes it:
The Intel Hardware Feedback Interface (HFI) provides information about the performance and energy efficiency of each CPU in the system. It uses a table that is shared between hardware and the operating system. The contents of the table may be updated as a result of changes in the operating conditions of the system (e.g., reaching a thermal limit) or the action of external factors (e.g., changes in the thermal design power).
The information that HFI provides are specified as numeric, unit-less capabilities relative to other CPUs in the system. These capabilities have a range of [0-255] where higher numbers represent higher capabilities. Energy efficiency and performance are reported in separate capabilities. If either the performance or energy capabilities efficiency of a CPU are 0, the hardware recommends to not schedule any tasks on such CPU for performance, energy efficiency or thermal reasons, respectively.
The kernel or user space may use the information from the HFI to modify task placement and/or adjust power limits. This patchset focuses on the user space. The thermal notification framework is extended to relay updates of CPU capacity. Thus, a userspace daemon can affinitize workloads to certain CPUs and/or offline CPUs whose capabilities are zero.
The frequency of HFI updates is specific to each processor model. On some systems, there is just a single HFI update at boot. On other systems, there may be updates every tens of milliseconds. In order to not overwhelm userspace with too many updates, they are limited to one update every CONFIG_HZ jiffies.
The new patches are still in revision, so it is unclear whether they will be implemented by the upcoming Linux 5.17 or delayed further into 2022.