This series centralizes the lcore ID verification in the power cpufreq
framework, replacing the per-driver range checks with a common validation
using the new EAL helper rte_lcore_is_eal_managed().
Background
----------
Currently, various cpufreq drivers implement their own lcore ID checks,
which are limited to simple range validation against RTE_MAX_LCORE and
involve significant code duplication across 12+ functions per driver.
The checks are duplicated across all drivers — any change requires
updating 5+ drivers identically. Moreover, these checks do not verify
whether the lcore is actually managed by the application (i.e., its
role is ROLE_RTE or ROLE_SERVICE).
The lcore ID validation requirements differ by power sub-component:
- For cpufreq-related APIs and power QoS APIs, although service cores
do not typically invoke these APIs, they may operate in polling modes
where power management is required. To maintain compatibility with
applications using service cores, the validation logic now explicitly
accepts both ROLE_RTE and ROLE_SERVICE, using the new
rte_lcore_is_eal_managed() helper.
- For PMD power management APIs, the lcore must be ROLE_RTE because
these are used together with the data plane of ethdev PMD. Hence,
rte_lcore_is_enabled() is used for validation.
Key Changes:
------------
Patch 1: Add rte_lcore_is_eal_managed() in EAL to check whether a
lcore is managed by EAL (ROLE_RTE or ROLE_SERVICE).
Patch 2: Add a common macro RTE_POWER_VALID_LCOREID_OR_ERR_RET()
in power_common.h for use across the power library.
Patch 3: Add the centralized lcore ID verification to the cpufreq
framework dispatch layer, so all driver ops are guarded.
Patches 4-8: Remove the now-redundant lcore_id >= RTE_MAX_LCORE
checks from acpi, amd_pstate, cppc, intel_pstate, and
kvm_vm drivers.
Patch 9: Update power QoS to use the new validation, allowing
service cores to configure QoS parameters.
Patch 10: Add lcore validation to PMD management functions.
Note:
- Passed devtools/checkpatches.sh (9/10 valid, 1 acceptable
MACRO_WITH_FLOW_CONTROL warning).
Changes:
-------
v3:
- update release note.
- add __rte_experimental for new helper function.
- restructure this patch set to facilitate review.
v2:
- allow the service cores to set power API.
--------
Huisong Li (10):
eal: add interface to check if lcore is EAL managed
power: add a common macro to verify lcore ID
power/cpufreq: add the lcore ID verification to framework
power/acpi: remove redundant lcore ID checks
power/amd_pstate: remove redundant lcore ID checks
power/cppc: remove redundant lcore ID checks
power/intel_pstate: remove redundant lcore ID checks
power/kvm_vm: remove redundant lcore ID checks
power: allow the service core to config power QoS
power: add lcore ID check for PMD mgmt
doc/guides/rel_notes/release_26_07.rst | 19 ++++++
drivers/power/acpi/acpi_cpufreq.c | 65 -------------------
drivers/power/amd_pstate/amd_pstate_cpufreq.c | 65 -------------------
drivers/power/cppc/cppc_cpufreq.c | 65 -------------------
.../power/intel_pstate/intel_pstate_cpufreq.c | 65 -------------------
drivers/power/kvm_vm/guest_channel.c | 22 -------
drivers/power/kvm_vm/kvm_vm.c | 10 ---
lib/eal/common/eal_common_lcore.c | 11 ++++
lib/eal/include/rte_lcore.h | 12 ++++
lib/power/power_common.h | 7 ++
lib/power/rte_power_cpufreq.c | 13 ++++
lib/power/rte_power_pmd_mgmt.c | 21 +++---
lib/power/rte_power_qos.c | 10 +--
13 files changed, 75 insertions(+), 310 deletions(-)
--
2.33.0