[PATCH v4 0/9] power: centralize lcore ID validation

lihuisong (C) lihuisong at huawei.com
Mon Jun 29 08:22:26 CEST 2026


Kindly ping for review.

On 6/15/2026 3:30 PM, Huisong Li wrote:
> This series centralizes the lcore ID verification in the power cpufreq
> framework, replacing the per-driver range checks with a common validation.
>
> 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. So it is better
> to verify lcore ID in cpufreq core.
>
> For cpufreq-related 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.
>
> The usage of power QoS APIs are similar to that of cpufreq. They also can
> accepts ROLE_RTE and ROLE_SERVICE.
>
> 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: Adds a common macro (RTE_POWER_VALID_LCOREID_OR_ERR_RET)
>           that accepts both roles.
> Patch 2: Adds the validation to the cpufreq framework layer.
> Patches 3-7: Remove the now-redundant per-driver RTE_MAX_LCORE checks.
> Patch 8: Update power QoS to use the new validation, allowing
>           service cores to configure QoS parameters.
> Patch 9: Add lcore validation to PMD management functions.
>
> Changes:
> --------
> v4: remove the patch that add the helper function rte_lcore_is_eal_managed.
>
> 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 (9):
>    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        |  7 ++
>   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/power/power_common.h                      |  8 +++
>   lib/power/rte_power_cpufreq.c                 | 13 ++++
>   lib/power/rte_power_pmd_mgmt.c                | 21 +++---
>   lib/power/rte_power_qos.c                     | 10 +--
>   11 files changed, 41 insertions(+), 310 deletions(-)
>


More information about the dev mailing list