[PATCH V2 00/15] power: unify and improve lcore ID verification

Huisong Li lihuisong at huawei.com
Thu May 7 04:42:15 CEST 2026


This patch series reworks the lcore ID verification logic within the
power library to ensure consistency and improve maintainability.

Currently, various cpufreq drivers implement their own lcore ID checks,
which are limited to simple range validation and involve significant
code duplication. Moreover, these checks do not account for whether the
core is actually managed by the application.

For the verification in 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
allows both ROLE_RTE and ROLE_SERVICE.

But the lcore ID in the pmd_mgmt library must be ROLE_RTE because it is
mainly used together with the data plane of ethdev PMD. So use
rte_lcore_is_enabled to verify.

Key Changes:
1. Add lcore role verification to individual cpufreq drivers.
2. Introduces a unified macro in the power library to standardize lcore ID
   checks.
3. Moves verification logic from individualdrivers to the framework level.
   This reduces code duplication.
4. Allow the service cores to configure power QoS.
5. Use rte_lcore_is_enabled to verfify the lcore ID in pmd_mgmt.

---
v2:
 - Allow the service cores to set power API.

---

Huisong Li (15):
  eal: add interface to check if lcore is EAL managed
  power/kvm_vm: validate lcore role in cpufreq API
  power/acpi_cpufreq: validate lcore role in cpufreq API
  power/amd_pstate: validate lcore role in cpufreq API
  power/cppc_cpufreq: validate lcore role in cpufreq API
  power/intel_pstate: validate lcore role in cpufreq API
  power: add a common macro to verify lcore ID
  power/cpufreq: add the lcore ID verification to framework
  power/acpi_cpufreq: remove the verification of lcore ID
  power/amd_pstate: remove the verification of lcore ID
  power/cppc_cpufreq: remove the verification of lcore ID
  power/intel_pstate: remove the verification of lcore ID
  power/kvm_vm: remove the verification of lcore ID
  power: allow the service core to config power QoS
  power: add lcore ID check for PMD mgmt

 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/kvm_vm.c                 | 10 ---
 lib/eal/common/eal_common_lcore.c             | 11 ++++
 lib/eal/include/rte_lcore.h                   | 11 ++++
 lib/power/power_common.h                      |  7 ++
 lib/power/rte_power_cpufreq.c                 | 14 +++-
 lib/power/rte_power_pmd_mgmt.c                | 21 +++---
 lib/power/rte_power_qos.c                     | 10 +--
 11 files changed, 55 insertions(+), 289 deletions(-)

-- 
2.33.0



More information about the dev mailing list