From: Gautham R.Shenoy <gautham.shenoy@amd.com>
To: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>,
<rafael@kernel.org>, <viresh.kumar@linaro.org>,
<mario.limonciello@amd.com>, <perry.yuan@amd.com>,
<skhan@linuxfoundation.org>, <li.meng@amd.com>,
<ray.huang@amd.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Dhananjay Ugwekar" <Dhananjay.Ugwekar@amd.com>,
David Arcari <darcari@redhat.com>
Subject: Re: [PATCH v2 2/2] cpufreq/amd-pstate: Fix the scaling_max_freq setting on shared memory CPPC systems
Date: Wed, 3 Jul 2024 11:16:36 +0530 [thread overview]
Message-ID: <87bk3fqb7n.fsf@BLR-5CG11610CF.amd.com> (raw)
In-Reply-To: <20240702081413.5688-3-Dhananjay.Ugwekar@amd.com>
Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com> writes:
> On shared memory CPPC systems, with amd_pstate=active mode, the change
> in scaling_max_freq doesn't get written to the shared memory
> region. Due to this, the writes to the scaling_max_freq sysfs file
> don't take effect. Fix this by propagating the scaling_max_freq
> changes to the shared memory region.
>
> Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors")
> Reported-by: David Arcari <darcari@redhat.com>
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
> ---
> drivers/cpufreq/amd-pstate.c | 43 +++++++++++++++++++-----------------
> 1 file changed, 23 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 9ad62dbe8bfb..a092b13ffbc2 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -247,6 +247,26 @@ static int amd_pstate_get_energy_pref_index(struct amd_cpudata *cpudata)
> return index;
> }
>
> +static void pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
> + u32 des_perf, u32 max_perf, bool fast_switch)
> +{
> + if (fast_switch)
> + wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached));
> + else
> + wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ,
> + READ_ONCE(cpudata->cppc_req_cached));
> +}
> +
> +DEFINE_STATIC_CALL(amd_pstate_update_perf, pstate_update_perf);
> +
> +static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata,
> + u32 min_perf, u32 des_perf,
> + u32 max_perf, bool fast_switch)
> +{
> + static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
> + max_perf, fast_switch);
> +}
> +
> static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
> {
> int ret;
> @@ -263,6 +283,9 @@ static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
> if (!ret)
> cpudata->epp_cached = epp;
> } else {
> + amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U,
> + cpudata->max_limit_perf, false);
> +
Looks good to me.
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> perf_ctrls.energy_perf = epp;
> ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
> if (ret) {
> @@ -452,16 +475,6 @@ static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)
> return static_call(amd_pstate_init_perf)(cpudata);
> }
>
> -static void pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
> - u32 des_perf, u32 max_perf, bool fast_switch)
> -{
> - if (fast_switch)
> - wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached));
> - else
> - wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ,
> - READ_ONCE(cpudata->cppc_req_cached));
> -}
> -
> static void cppc_update_perf(struct amd_cpudata *cpudata,
> u32 min_perf, u32 des_perf,
> u32 max_perf, bool fast_switch)
> @@ -475,16 +488,6 @@ static void cppc_update_perf(struct amd_cpudata *cpudata,
> cppc_set_perf(cpudata->cpu, &perf_ctrls);
> }
>
> -DEFINE_STATIC_CALL(amd_pstate_update_perf, pstate_update_perf);
> -
> -static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata,
> - u32 min_perf, u32 des_perf,
> - u32 max_perf, bool fast_switch)
> -{
> - static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
> - max_perf, fast_switch);
> -}
> -
> static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)
> {
> u64 aperf, mperf, tsc;
> --
> 2.34.1
next prev parent reply other threads:[~2024-07-03 5:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 8:14 [PATCH v2 0/2] AMD Pstate driver fixes Dhananjay Ugwekar
2024-07-02 8:14 ` [PATCH v2 1/2] cpufreq/amd-pstate-ut: Convert nominal_freq to khz during comparisons Dhananjay Ugwekar
2024-07-02 8:14 ` [PATCH v2 2/2] cpufreq/amd-pstate: Fix the scaling_max_freq setting on shared memory CPPC systems Dhananjay Ugwekar
2024-07-02 17:49 ` Mario Limonciello
2024-09-03 17:51 ` Jones, Morgan
2024-09-03 17:54 ` Mario Limonciello
2024-09-03 20:07 ` [EXTERNAL] " Jones, Morgan
2024-09-03 20:09 ` Mario Limonciello
2024-09-03 20:51 ` Mario Limonciello
2024-09-03 20:52 ` Jones, Morgan
2024-09-03 22:21 ` Jones, Morgan
2024-09-03 22:24 ` Jones, Morgan
2024-09-04 13:57 ` Mario Limonciello
2024-09-05 15:11 ` Mario Limonciello
2024-09-05 21:09 ` Jones, Morgan
2024-09-05 21:14 ` linux-6.6.y regression on amd-pstate Mario Limonciello
2024-09-08 14:05 ` Greg Kroah-Hartman
2024-09-08 14:12 ` Christian Heusel
2024-09-08 14:29 ` Greg Kroah-Hartman
2025-07-31 20:44 ` [EXTERNAL] " Jones, Morgan
2025-08-01 12:32 ` Mario Limonciello
2024-09-03 20:52 ` [EXTERNAL] Re: [PATCH v2 2/2] cpufreq/amd-pstate: Fix the scaling_max_freq setting on shared memory CPPC systems Jones, Morgan
2024-07-03 5:46 ` Gautham R.Shenoy [this message]
2024-07-02 8:24 ` [PATCH v2 0/2] AMD Pstate driver fixes Dhananjay Ugwekar
2024-07-02 17:54 ` Mario Limonciello
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=87bk3fqb7n.fsf@BLR-5CG11610CF.amd.com \
--to=gautham.shenoy@amd.com \
--cc=Dhananjay.Ugwekar@amd.com \
--cc=darcari@redhat.com \
--cc=li.meng@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=perry.yuan@amd.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=skhan@linuxfoundation.org \
--cc=viresh.kumar@linaro.org \
/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