[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f099c236-b9d5-4d73-9176-c91f54acffd0@kylinos.cn>
Date: Mon, 8 Sep 2025 08:41:10 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Linux PM <linux-pm@...r.kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>, Viresh Kumar <viresh.kumar@...aro.org>,
Jonathan Cameron <jonathan.cameron@...wei.com>
Subject: Re: [PATCH v1 1/3] cpufreq: intel_pstate: Fix object lifecycle issue
in update_qos_request()
在 2025/9/5 21:52, Rafael J. Wysocki 写道:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> The cpufreq_cpu_put() call in update_qos_request() takes place too early
> because the latter subsequently calls freq_qos_update_request() that
> indirectly accesses the policy object in question through the QoS request
> object passed to it.
>
> Fortunately, update_qos_request() is called under intel_pstate_driver_lock,
> so this issue does not matter for changing the intel_pstate operation
> mode, but it theoretically can cause a crash to occur on CPU device hot
> removal (which currently can only happen in virt, but it is formally
> supported nevertheless).
>
> Address this issue by modifying update_qos_request() to drop the
> reference to the policy later.
>
> Fixes: da5c504c7aae ("cpufreq: intel_pstate: Implement QoS supported freq constraints")
> Cc: 5.4+ <stable@...r.kernel.org> # 5.4+
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/cpufreq/intel_pstate.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -1708,10 +1708,10 @@ static void update_qos_request(enum freq
> continue;
>
> req = policy->driver_data;
> - cpufreq_cpu_put(policy);
> -
> - if (!req)
> + if (!req) {
> + cpufreq_cpu_put(policy);
> continue;
> + }
>
> if (hwp_active)
> intel_pstate_get_hwp_cap(cpu);
> @@ -1727,6 +1727,8 @@ static void update_qos_request(enum freq
>
> if (freq_qos_update_request(req, freq) < 0)
> pr_warn("Failed to update freq constraint: CPU%d\n", i);
> +
> + cpufreq_cpu_put(policy);
> }
> }
>
Reviewed-by: Zihuan Zhang <zhangzihuan@...inos.cn>
Powered by blists - more mailing lists