Page MenuHomeFreeBSD

sys: add cpucap
Needs ReviewPublic

Authored by minsoochoo0122_proton.me on Mon, Jan 12, 8:36 PM.

Details

Reviewers
andrew
manu
Summary

This adds initial support for HMP.

The proposed framework, cpucap, sits between scheduler and provider. sched_ule(4) will invoke cpucap APIs for thread placement (score) and load balancing (capacity). Providers such as Intel ITD, device trees, and ACPI CPPC will give static or dynamic scores and capacity information to cpucap so the scheduler can utilize this information. Providers like Arm SCMI let scheduler to control processor performance on demand.

cpucap is designed to be architecture agnoistic, that is, kern/sched_ule.c and kern/subr_hmp shouldn't have any machine-dependent code, and all machine-dependent code happens in sys/dev (dynamic provider using device drivers) and sys/arch (static provider such as device tree). For architectures that doesn't have homogeneous cores like powerpc and riscv, default values will be used for capacity.

The proposed coredirector(4) patch (D44456) is a example of provider, although it doesn't use cpucap API yet. Once this patch is adopted, coredirector(4) can utilize this framework to store dynamic scores from Intel Thread Director and scheduler can utilize it.

This is only enabled when HMP option is on. The framework structure is subject to be changed at any time for better scheduler/provider interaction.

References:
sys/contrib/device-tree/Bindings/cpu/cpu-capacity.txt gives a good insight on utilizing device-tree files for static capacity scores.

Next steps:

  • add sysctl for cpucap/hmp
  • document hmp(4) on man page
  • integrate hmp into sched_ule(4)
  • add providers such as ITD, ACPI, device trees, etc.
Test Plan

Currently no functional change, so only build success is required.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69840
Build 66723: arc lint + arc unit

Event Timeline

minsoochoo0122_proton.me updated this revision to Diff 169539.

Fix old header guards

minsoochoo0122_proton.me retitled this revision from options: add HMP to sys: add machine-independent cpucap stuff.Mon, Jan 12, 8:40 PM
minsoochoo0122_proton.me edited the summary of this revision. (Show Details)
minsoochoo0122_proton.me retitled this revision from sys: add machine-independent cpucap stuff to sys: add cpucap.Mon, Jan 12, 8:44 PM

No need to initialize score. If there is no dynamic score, capacity will be used. If there is dynamic score, it will be filled by machine dependent initializer.