[PATCH v2 1/2] power: introduce PM QoS API on CPU wide

Morten Brørup mb at smartsharesystems.com
Fri Jun 14 10:04:07 CEST 2024


> +#define PM_QOS_SYSFILE_RESUME_LATENCY_US	\
> +	"/sys/devices/system/cpu/cpu%u/power/pm_qos_resume_latency_us"

Is it OK to access this path using the lcore_id as CPU parameter to open_core_sysfs_file(), or must it be mapped through rte_lcore_to_cpu_id(lcore_id) first?

@David, do you know?

> +
> +int
> +rte_power_qos_set_cpu_resume_latency(uint16_t lcore_id, int latency)
> +{
> +	char buf[BUFSIZ] = {0};
> +	FILE *f;
> +	int ret;
> +
> +	if (lcore_id >= RTE_MAX_LCORE) {
> +		POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
> +			  lcore_id, RTE_MAX_LCORE - 1U);
> +		return -EINVAL;
> +	}

The lcore_id could be a registered non-EAL thread.
You should probably fail in that case.

Same comment for rte_power_qos_get_cpu_resume_latency().


> +#define PM_QOS_STRICT_LATENCY_VALUE             0
> +#define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT    ((int)(UINT32_MAX >> 1))

These definitions are in the public header file, and thus should be RTE_POWER_ prefixed and have comments describing them.



More information about the dev mailing list