From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Lifeng Zheng <zhenglifeng1@huawei.com>
Cc: catalin.marinas@arm.com, will@kernel.org, rafael@kernel.org,
viresh.kumar@linaro.org, beata.michalska@arm.com,
sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linuxarm@huawei.com, jonathan.cameron@huawei.com,
vincent.guittot@linaro.org, yangyicong@hisilicon.com,
zhanjie9@hisilicon.com, lihuisong@huawei.com,
yubowen8@huawei.com, zhangpengjie2@huawei.com,
linhongye@h-partners.com
Subject: Re: [PATCH v5 2/3] cpufreq: Add a new function to get cpufreq policy without checking if the CPU is online
Date: Tue, 19 Aug 2025 21:05:03 +0200 [thread overview]
Message-ID: <CAJZ5v0i7g8i8m9GPi9=-Y0x36491Ng3akUfVP2vPOBS-OAEg=w@mail.gmail.com> (raw)
In-Reply-To: <20250819072931.1647431-3-zhenglifeng1@huawei.com>
On Tue, Aug 19, 2025 at 9:30 AM Lifeng Zheng <zhenglifeng1@huawei.com> wrote:
>
> cpufreq_cpu_get_raw() gets cpufreq policy only if the CPU is in
> policy->cpus mask, which means the CPU is already online. But in some
> cases, the policy is needed before the CPU is added to cpus mask. Add a
> function to get the policy in these cases.
I'd prefer the subject to be somewhat shorter. For instance, something like
cpufreq: Add new helper function returning cpufreq policy
would suffice because the changelog explains the details.
With that addressed
Reviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
> ---
> drivers/cpufreq/cpufreq.c | 6 ++++++
> include/linux/cpufreq.h | 5 +++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index fc7eace8b65b..78ca68ea754d 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -198,6 +198,12 @@ struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu)
> }
> EXPORT_SYMBOL_GPL(cpufreq_cpu_get_raw);
>
> +struct cpufreq_policy *cpufreq_cpu_policy(unsigned int cpu)
> +{
> + return per_cpu(cpufreq_cpu_data, cpu);
> +}
> +EXPORT_SYMBOL_GPL(cpufreq_cpu_policy);
> +
> unsigned int cpufreq_generic_get(unsigned int cpu)
> {
> struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 95f3807c8c55..26b3c3310d5b 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -205,6 +205,7 @@ struct cpufreq_freqs {
>
> #ifdef CONFIG_CPU_FREQ
> struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu);
> +struct cpufreq_policy *cpufreq_cpu_policy(unsigned int cpu);
> struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu);
> void cpufreq_cpu_put(struct cpufreq_policy *policy);
> #else
> @@ -212,6 +213,10 @@ static inline struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu)
> {
> return NULL;
> }
> +static inline struct cpufreq_policy *cpufreq_cpu_policy(unsigned int cpu)
> +{
> + return NULL;
> +}
> static inline struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu)
> {
> return NULL;
> --
> 2.33.0
>
>
next prev parent reply other threads:[~2025-08-19 19:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 7:29 [PATCH v5 0/3] arm64: topology: Setup AMU FIE for online CPUs only Lifeng Zheng
2025-08-19 7:29 ` [PATCH v5 1/3] arm64: topology: Set scale freq source only for the CPUs that have not been set before Lifeng Zheng
2025-08-20 9:22 ` Beata Michalska
2025-08-30 4:08 ` Jie Zhan
2025-08-19 7:29 ` [PATCH v5 2/3] cpufreq: Add a new function to get cpufreq policy without checking if the CPU is online Lifeng Zheng
2025-08-19 19:05 ` Rafael J. Wysocki [this message]
2025-08-20 1:50 ` zhenglifeng (A)
2025-08-30 4:11 ` Jie Zhan
2025-08-19 7:29 ` [PATCH v5 3/3] arm64: topology: Setup AMU FIE for online CPUs only Lifeng Zheng
2025-08-20 9:21 ` Beata Michalska
2025-08-30 10:20 ` Jie Zhan
2025-09-01 7:29 ` Ionela Voinescu
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='CAJZ5v0i7g8i8m9GPi9=-Y0x36491Ng3akUfVP2vPOBS-OAEg=w@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=beata.michalska@arm.com \
--cc=catalin.marinas@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=lihuisong@huawei.com \
--cc=linhongye@h-partners.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=sudeep.holla@arm.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
--cc=yubowen8@huawei.com \
--cc=zhangpengjie2@huawei.com \
--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;
as well as URLs for NNTP newsgroup(s).