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.