Page MenuHomeFreeBSD

coreindex(4) - Manual capacity/score configuration driver for hmp(4) - Part1: Add coreindex driver's source-code & Makefile.
Needs ReviewPublic

Authored by koinec_yahoo.co.jp on Mon, Jun 29, 1:17 PM.

Details

Summary

The proposals for sched_ule(4) (D57941) and hmp(4) (D56546, D56547, D56548, D57939) enable CPU core allocation optimization in heterogeneous multi-core environments; however, the only driver currently supporting this is intelhfi(4), designed for Intel hybrid architecture CPUs.

Therefore, as an interim measure, I propose a driver that allows for the manual configuration of performance values for each CPU core via the /boot/loader.conf file or the sysctl interface.
Using this driver makes it possible to benefit from heterogeneous multi-core support in scenarios such as the following:

  • Heterogeneous multi-core environments where the hardware does not provide a way to retrieve performance values for individual CPU cores (e.g., AMD Ryzen X3D processors)
  • Arm-based big.LITTLE processor environments where no hmp(4) provider driver is available
  • Heterogeneous multi-core environments that support hardware-based performance reporting, but where the user prefers to manually configure core performance values instead of using that feature
  • Debugging within virtualized environments

To use this patch, you must also apply the hmp(4) patches (D56546, D56547, D56548, D57939).
Additionally, you must either include "device coreindex" in your kernel configuration file before building or add coreindex_load="YES" to /boot/loader.conf to load the driver.
In either case, the kernel must be built with "options HMP" included in the kernel configuration file. Furthermore, if sched_ule(4) (D57941) is not applied, scheduling will not improve even if the value is set.

<Usage>
Manual creation is currently lagging behind development.
Therefore, a brief summary of usage is provided below.

  • capacity: Performance capability value for each CPU core
    • Set the value in the /boot/loader.conf file using the syntax hw.coreindex.<core_id>.capacity.
    • The value can range from 1 to 1024; a higher value indicates higher performance. No normalization is required if the value is within the 1–1024 range.
    • Note that this value can only be set at boot time via /boot/loader.conf and cannot be changed while the system is running.
  • performance score: Dynamic performance metric for each CPU core
    • Set the value in the /boot/loader.conf file using the syntax hw.coreindex.<core_id>.performance.
    • The value can range from 0 to 1024; a higher value indicates higher performance. No normalization is required if the value is within the 0–1024 range.
    • This value can also be modified directly during runtime using the sysctl command to change hw.coreindex.<core_id>.performance.
  • efficiency score: Dynamic power-saving metric for each CPU core
    • Set the value in the /boot/loader.conf file using the syntax hw.coreindex.<core_id>.efficiency.
    • The value can range from 0 to 1024; a higher value indicates higher performance. No normalization is required if the value is within the 0–1024 range.
    • This value can also be modified directly during runtime using the sysctl command to change hw.coreindex.<core_id>.efficiency.
    • Note that since sched_ule(4) does not currently support the power-saving metric, setting this value will not improve scheduling or battery runtime.
Test Plan

I have verified that settings can be configured via at least the /boot/loader.conf file and the sysctl interface.
As this driver has primarily been used for debugging purposes until now, I must admit that testing has been somewhat limited.

However, since it appears useful for validating the sched_ule(4) changes proposed in D57941, I am submitting this proposal - albeit perhaps a bit prematurely.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped