[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jdJZ2upvE4KzDnc59KpMX+oqYbq=ZW=SXfwvjBctMj3Q@mail.gmail.com>
Date: Fri, 5 Sep 2025 15:31:58 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Zihuan Zhang <zhangzihuan@...inos.cn>
Cc: "Rafael J . wysocki" <rafael@...nel.org>, Viresh Kumar <viresh.kumar@...aro.org>,
Jonathan Cameron <jonathan.cameron@...wei.com>, Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>, Michael Ellerman <mpe@...erman.id.au>,
Krzysztof Kozlowski <krzk@...nel.org>, Alim Akhtar <alim.akhtar@...sung.com>,
Thierry Reding <thierry.reding@...il.com>, MyungJoo Ham <myungjoo.ham@...sung.com>,
Kyungmin Park <kyungmin.park@...sung.com>, Chanwoo Choi <cw00.choi@...sung.com>,
Jani Nikula <jani.nikula@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tursulin@...ulin.net>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Daniel Lezcano <daniel.lezcano@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>, Shawn Guo <shawnguo@...nel.org>,
Eduardo Valentin <edubezval@...il.com>, Keerthy <j-keerthy@...com>, Ben Horgan <ben.horgan@....com>,
zhenglifeng <zhenglifeng1@...wei.com>, Zhang Rui <rui.zhang@...el.com>,
Len Brown <lenb@...nel.org>, Lukasz Luba <lukasz.luba@....com>,
Pengutronix Kernel Team <kernel@...gutronix.de>, Beata Michalska <beata.michalska@....com>,
Fabio Estevam <festevam@...il.com>, Pavel Machek <pavel@...nel.org>, Sumit Gupta <sumitg@...dia.com>,
Prasanna Kumar T S M <ptsm@...ux.microsoft.com>, Sudeep Holla <sudeep.holla@....com>,
Yicong Yang <yangyicong@...ilicon.com>, linux-pm@...r.kernel.org,
linux-acpi@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...ts.infradead.org, intel-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, imx@...ts.linux.dev,
linux-omap@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 3/6] cpufreq: intel_pstate: Use scope-based cleanup helper
On Fri, Sep 5, 2025 at 3:24 PM Zihuan Zhang <zhangzihuan@...inos.cn> wrote:
>
> Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy)
> annotation for policy references. This reduces the risk of reference
> counting mistakes and aligns the code with the latest kernel style.
>
> No functional change intended.
>
> Signed-off-by: Zihuan Zhang <zhangzihuan@...inos.cn>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
No, sorry. I've already said that this isn't going to work:
https://lore.kernel.org/linux-pm/CAJZ5v0gN1T5woSF0tO=TbAh+2-sWzxFjWyDbB7wG2TFCOU01iQ@mail.gmail.com/
so why are you resending it?
And making changes to it in the process without saying what they are?
Please stop adding confusion.
> ---
> drivers/cpufreq/intel_pstate.c | 59 +++++++++++++++++++---------------
> 1 file changed, 33 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index f366d35c5840..0b54e08f9447 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -1502,9 +1502,8 @@ static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
>
> static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
> {
> - struct cpufreq_policy *policy __free(put_cpufreq_policy);
> + struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
>
> - policy = cpufreq_cpu_get(cpudata->cpu);
> if (!policy)
> return false;
>
> @@ -1695,41 +1694,49 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
> return count;
> }
>
> -static void update_qos_request(enum freq_qos_req_type type)
> +static bool intel_pstate_cpufreq_update_limits(int cpu, enum freq_qos_req_type type)
> {
> struct freq_qos_request *req;
> - struct cpufreq_policy *policy;
> - int i;
> + unsigned int freq, perf_pct;
> + struct cpudata *data = all_cpu_data[cpu];
> + struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
>
> - for_each_possible_cpu(i) {
> - struct cpudata *cpu = all_cpu_data[i];
> - unsigned int freq, perf_pct;
> + if (!policy)
> + return false;
>
> - policy = cpufreq_cpu_get(i);
> - if (!policy)
> - continue;
> + req = policy->driver_data;
>
> - req = policy->driver_data;
> - cpufreq_cpu_put(policy);
> + if (!req)
> + return false;
>
> - if (!req)
> - continue;
> + if (hwp_active)
> + intel_pstate_get_hwp_cap(data);
>
> - if (hwp_active)
> - intel_pstate_get_hwp_cap(cpu);
> + if (type == FREQ_QOS_MIN) {
> + perf_pct = global.min_perf_pct;
> + } else {
> + req++;
> + perf_pct = global.max_perf_pct;
> + }
>
> - if (type == FREQ_QOS_MIN) {
> - perf_pct = global.min_perf_pct;
> - } else {
> - req++;
> - perf_pct = global.max_perf_pct;
> - }
> + freq = DIV_ROUND_UP(data->pstate.turbo_freq * perf_pct, 100);
>
> - freq = DIV_ROUND_UP(cpu->pstate.turbo_freq * perf_pct, 100);
> + if (freq_qos_update_request(req, freq) < 0)
> + pr_warn("Failed to update freq constraint: CPU%d\n", cpu);
>
> - if (freq_qos_update_request(req, freq) < 0)
> - pr_warn("Failed to update freq constraint: CPU%d\n", i);
> + return true;
> +}
> +
> +
> +static void update_qos_request(enum freq_qos_req_type type)
> +{
> + int i;
> +
> + for_each_possible_cpu(i) {
> + if (!intel_pstate_cpufreq_update_limits(i, type))
> + continue;
> }
> +
> }
>
> static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b,
> --
> 2.25.1
>
>
Powered by blists - more mailing lists