Linux ACPI
 help / color / mirror / Atom feed
From: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
To: Christian Loehle <christian.loehle@arm.com>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, Len Brown <lenb@kernel.org>,
	Jie Zhan <zhanjie9@hisilicon.com>,
	Lifeng Zheng <zhenglifeng1@huawei.com>,
	Pierre Gondois <pierre.gondois@arm.com>,
	Sumit Gupta <sumitg@nvidia.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Ionela Voinescu <ionela.voinescu@arm.com>,
	zhongqiu.han@oss.qualcomm.com
Subject: Re: [PATCHv2 3/3] ACPI: CPPC: Stop reading desired_perf in cppc_get_perf()
Date: Fri, 31 Jul 2026 21:19:15 +0800	[thread overview]
Message-ID: <d78e2efb-c0fe-49bf-83b4-b681095adad4@oss.qualcomm.com> (raw)
In-Reply-To: <20260729100245.2628302-4-christian.loehle@arm.com>

On 7/29/2026 6:02 PM, Christian Loehle wrote:
> cppc_get_perf() has one in-tree caller, cppc_cpufreq_get_cpu_data().
> It uses the function to preserve existing controls before writing them, but
> overwrites desired_perf with highest_perf before the first cppc_set_perf().
> Consequently, the current Desired Performance value is not consumed.
> 
> Remove the Desired Performance read from this aggregate getter and
> document that the field is returned as zero.
> 
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
> ---
>   drivers/acpi/cppc_acpi.c | 23 ++++++++---------------
>   1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 210988d57b71..8ce2033ba993 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1828,22 +1828,22 @@ int cppc_set_enable(int cpu, bool enable)
>   EXPORT_SYMBOL_GPL(cppc_set_enable);
>   
>   /**
> - * cppc_get_perf - Get a CPU's performance controls.
> + * cppc_get_perf - Get a CPU's readable performance controls.

Small nit: is this also applicable to ACPI <6.6?

>    * @cpu: CPU for which to get performance controls.
>    * @perf_ctrls: ptr to cppc_perf_ctrls. See cppc_acpi.h
>    *
> + * Desired Performance is not read and is returned as 0.

Likewise.

> + *
>    * Return: 0 for success with perf_ctrls, -ERRNO otherwise.
>    */
>   int cppc_get_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
>   {
>   	struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu);
> -	struct cpc_register_resource *desired_perf_reg,
> -				     *min_perf_reg, *max_perf_reg,
> +	struct cpc_register_resource *min_perf_reg, *max_perf_reg,
>   				     *energy_perf_reg, *auto_sel_reg;
> -	u64 desired_perf = 0, min = 0, max = 0, energy_perf = 0, auto_sel = 0;
> +	u64 min = 0, max = 0, energy_perf = 0, auto_sel = 0;
>   	int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
>   	struct cppc_pcc_data *pcc_ss_data = NULL;
> -	bool read_desired_perf = cppc_desired_perf_readable();
>   	int ret = 0, regs_in_pcc = 0;
>   
>   	if (!cpc_desc) {
> @@ -1856,16 +1856,14 @@ int cppc_get_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
>   		return -EINVAL;
>   	}
>   
> -	desired_perf_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
>   	min_perf_reg = &cpc_desc->cpc_regs[MIN_PERF];
>   	max_perf_reg = &cpc_desc->cpc_regs[MAX_PERF];
>   	energy_perf_reg = &cpc_desc->cpc_regs[ENERGY_PERF];
>   	auto_sel_reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE];
>   
>   	/* Are any of the regs PCC ?*/
> -	if ((read_desired_perf && CPC_IN_PCC(desired_perf_reg)) ||
> -	    CPC_IN_PCC(min_perf_reg) ||
> -	    CPC_IN_PCC(max_perf_reg) || CPC_IN_PCC(energy_perf_reg) ||
> +	if (CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg) ||
> +	    CPC_IN_PCC(energy_perf_reg) ||
>   	    CPC_IN_PCC(auto_sel_reg)) {
>   		if (pcc_ss_id < 0) {
>   			pr_debug("Invalid pcc_ss_id for CPU:%d\n", cpu);
> @@ -1896,12 +1894,7 @@ int cppc_get_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
>   	}
>   	perf_ctrls->min_perf = min;
>   
> -	if (read_desired_perf && CPC_SUPPORTED(desired_perf_reg)) {
> -		ret = cpc_read(cpu, desired_perf_reg, &desired_perf);
> -		if (ret)
> -			goto out_err;
> -	}
> -	perf_ctrls->desired_perf = desired_perf;
> +	perf_ctrls->desired_perf = 0;
>   
>   	if (CPC_SUPPORTED(energy_perf_reg)) {
>   		ret = cpc_read(cpu, energy_perf_reg, &energy_perf);

This is an exported API, I'm not sure whether this would break any out
of-tree users, but I don't think compatibility concerns for out-of-tree
users should weigh heavily in this case.

Looks good to me.

Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>

-- 
Thx and BRs,
Zhongqiu Han

  reply	other threads:[~2026-07-31 13:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 10:02 [PATCHv2 0/3] ACPI: CPPC: Avoid Desired Performance reads on ACPI 6.6+ Christian Loehle
2026-07-29 10:02 ` [PATCHv2 1/3] ACPI: CPPC: Reject desired_perf " Christian Loehle
2026-07-31 10:45   ` Zhongqiu Han
2026-08-03  9:12     ` Christian Loehle
2026-07-31 20:52   ` Sumit Gupta
2026-07-29 10:02 ` [PATCHv2 2/3] ACPI: CPPC: Skip desired_perf read in cppc_get_perf() Christian Loehle
2026-07-31 12:38   ` Zhongqiu Han
2026-07-29 10:02 ` [PATCHv2 3/3] ACPI: CPPC: Stop reading desired_perf " Christian Loehle
2026-07-31 13:19   ` Zhongqiu Han [this message]
2026-08-03 10:02 ` [PATCH v3 0/3] ACPI: CPPC: Avoid Desired Performance reads on ACPI 6.6+ Christian Loehle
2026-08-03 10:02   ` [PATCH v3 1/3] ACPI: CPPC: Reject desired_perf " Christian Loehle
2026-08-03 14:38     ` Rafael J. Wysocki (Intel)
2026-08-03 14:44       ` Christian Loehle
2026-08-03 10:02   ` [PATCH v3 2/3] ACPI: CPPC: Skip desired_perf read in cppc_get_perf() Christian Loehle
2026-08-03 14:43     ` Rafael J. Wysocki (Intel)
2026-08-03 10:02   ` [PATCH v3 3/3] ACPI: CPPC: Stop reading desired_perf " Christian Loehle
2026-08-03 13:07   ` [PATCH v3 0/3] ACPI: CPPC: Avoid Desired Performance reads on ACPI 6.6+ Sumit Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d78e2efb-c0fe-49bf-83b4-b681095adad4@oss.qualcomm.com \
    --to=zhongqiu.han@oss.qualcomm.com \
    --cc=christian.loehle@arm.com \
    --cc=ionela.voinescu@arm.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pierre.gondois@arm.com \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=sumitg@nvidia.com \
    --cc=viresh.kumar@linaro.org \
    --cc=zhanjie9@hisilicon.com \
    --cc=zhenglifeng1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox