Page MenuHomeFreeBSD

intelhfi - Intel TD/HFI driver - Part4: Add intelhfi driver's source-code & Makefile.
Needs RevisionPublic

Authored by koinec_yahoo.co.jp on Mar 21 2024, 12:33 PM.
Referenced Files
Unknown Object (File)
Tue, Jan 20, 12:11 PM
Unknown Object (File)
Mon, Jan 19, 3:20 PM
Unknown Object (File)
Mon, Jan 19, 2:08 PM
Unknown Object (File)
Mon, Jan 19, 8:23 AM
Unknown Object (File)
Mon, Jan 19, 5:03 AM
Unknown Object (File)
Sun, Jan 18, 11:22 PM
Unknown Object (File)
Thu, Jan 15, 11:39 PM
Unknown Object (File)
Thu, Jan 15, 6:58 AM

Details

Summary

I developed the Intel Thread Director (ITD) / Hardware Feedback Interfce (HFI) device driver to obtain performance/efficiency information for each CPU core, which was implemented to improve the performance of Intel hybrid architecture CPUs. (e.g. Raptor Lake (refresh), Alder Lake, LakeField processors)

This driver simply obtains performance/efficiency information from the CPU and stores it in the "cpu_group" struct data referenced by the ULE scheduler.
However, since the ULE scheduler side is not yet supported, performance/efficiency cannot be improved by installing this driver at this time.

I will try to modify the ULE scheduler side in the future, but I posted this driver first because it can be implemented independently of this driver and it is difficult to modify the ULE scheduler.

There are seven patches, and this is the Part 4.
This patch is the source code and Makefile of the intelhfi driver that I developed this time.

This patch depends on the following patches:

Test Plan

With the remaining patches to be submitted later, I ran the tests listed below.

  • FreeBSD 15-current: Be able to apply patches and build to the latest source tree as of 2024/03/20.
  • FreeBSD 14.0-Release: The source tree can be patched and built. After building, it is possible to load the driver and correctly obtain performance values from the CPU.

Due to my development environment, I developed it on FreeBSD 14.0-RELEASE and ported it to FreeBSD 15-current on a virtual environment.
However, I have also confirmed that the parts related to the code modified this time have hardly changed between 14.0-RELEASE and 15-current.
For this reason, I believe that it will probably work with 15-current, but if you are able to test it, please help confirm that it works.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

koinec_yahoo.co.jp created this revision.

Attach the full context patch file.
{F79836034}

Fix CPUID Leaf6 define strings.

Attach the patch file created with the git format-patch command.

minsoochoo0122_proton.me added inline comments.
sys/dev/coredirector/coredirector.c
60

device_printf(9)

65

What stops from using __builtin_popcount()?

73

Could be bitwise: (n + 7) & (~7)

162

M_COREDIR matches the name.

351

Support for LP-E?

sys/dev/coredirector/coredirector.c
351

I searched the internet for LP-E, and it looks like CPUID_HF_EFFICIENCY is applied for both E and LP-E cores. Linux has cache info in their topology, but since FreeBSD seems to lack this, we need to manually query cpuid leaf 4.

There is also reference HFI source code from Intel available at https://github.com/intel/intel_hfi

koinec_yahoo.co.jp retitled this revision from coredirector - Intel TD/HFI driver - Part4: Add coredirector driver's source-code & Makefile. to intelhfi - Intel TD/HFI driver - Part4: Add coredirector driver's source-code & Makefile..
koinec_yahoo.co.jp edited the summary of this revision. (Show Details)
  • Fix the driver name (coredirector -> intelhfi)
  • Fix review findings. (__builtin_popcount, device_printf, etc)
koinec_yahoo.co.jp retitled this revision from intelhfi - Intel TD/HFI driver - Part4: Add coredirector driver's source-code & Makefile. to intelhfi - Intel TD/HFI driver - Part4: Add intelhfi driver's source-code & Makefile..Wed, Feb 4, 12:54 PM
sys/dev/coredirector/coredirector.c
351

As far as I know, it also supports LP-E cores.

I understand that the Intel Hardware Feedback Interface is not a table with performance index value for each Performance core/Efficiency core/Low-Power Efficiency core, but rather a table with two values ​​for each core group: a performance index value (how fast it can calculate) and a power saving index value (how power efficient it is).

For this reason, I understand that LP-E cores simply have a smaller performance index value and a larger power saving index value than other cores.

However, when I created this driver, I did not have a CPU with an LP-E core, so I have not been able to confirm this. I will take some time to look into it.

sys/conf/files.amd64
126

alphabetical order

sys/modules/Makefile
89

alphabetical order

805

alphabetical order

This revision now requires changes to proceed.Wed, Feb 4, 7:39 PM