All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor
@ 2022-07-09 14:19 Perry Yuan
  2022-07-11 19:33 ` Nathan Fontenot
  0 siblings, 1 reply; 3+ messages in thread
From: Perry Yuan @ 2022-07-09 14:19 UTC (permalink / raw)
  To: rafael.j.wysocki, viresh.kumar, Ray.Huang
  Cc: Deepak.Sharma, Mario.Limonciello, Nathan.Fontenot,
	Alexander.Deucher, Jinzhou.Su, Xinmei.Huang, Xiaojian.Du,
	Li.Meng, linux-pm, linux-kernel, Perry Yuan

The patch will fix the invalid desired perf value for powersave
governor. This issue is found when testing on one AMD EPYC system, the
actual des_perf is smaller than the min_perf value, that is invalid
value. because the min_perf is the lowest_perf system can support in
idle state.

Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 7c51f4125263..8a2b6ad9b8c0 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -265,6 +265,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
 	u64 value = prev;
 
+	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
 	value &= ~AMD_CPPC_MIN_PERF(~0L);
 	value |= AMD_CPPC_MIN_PERF(min_perf);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor
  2022-07-09 14:19 [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor Perry Yuan
@ 2022-07-11 19:33 ` Nathan Fontenot
  2022-07-12  9:28   ` Yuan, Perry
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Fontenot @ 2022-07-11 19:33 UTC (permalink / raw)
  To: Perry Yuan, rafael.j.wysocki, viresh.kumar, Ray.Huang
  Cc: Deepak.Sharma, Mario.Limonciello, Nathan.Fontenot,
	Alexander.Deucher, Jinzhou.Su, Xinmei.Huang, Xiaojian.Du,
	Li.Meng, linux-pm, linux-kernel

On 7/9/22 09:19, Perry Yuan wrote:
> The patch will fix the invalid desired perf value for powersave
> governor. This issue is found when testing on one AMD EPYC system, the
> actual des_perf is smaller than the min_perf value, that is invalid
> value. because the min_perf is the lowest_perf system can support in
> idle state.
> 
> Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 7c51f4125263..8a2b6ad9b8c0 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -265,6 +265,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
>  	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
>  	u64 value = prev;
>  
> +	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);

You should also update amd_pstate_adjust_perf() to remove the clamp_t() call now
that it is done here.

-Nathan

>  	value &= ~AMD_CPPC_MIN_PERF(~0L);
>  	value |= AMD_CPPC_MIN_PERF(min_perf);
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor
  2022-07-11 19:33 ` Nathan Fontenot
@ 2022-07-12  9:28   ` Yuan, Perry
  0 siblings, 0 replies; 3+ messages in thread
From: Yuan, Perry @ 2022-07-12  9:28 UTC (permalink / raw)
  To: Fontenot, Nathan, rafael.j.wysocki, viresh.kumar, Huang, Ray
  Cc: Sharma, Deepak, Limonciello, Mario, Deucher, Alexander, Su,
	Jinzhou (Joe), Huang, Shimmer, Du, Xiaojian, Meng, Li (Jassmine),
	linux-pm, linux-kernel

[AMD Official Use Only - General]

Hi Nathan.

> -----Original Message-----
> From: Fontenot, Nathan <Nathan.Fontenot@amd.com>
> Sent: Tuesday, July 12, 2022 3:34 AM
> To: Yuan, Perry <Perry.Yuan@amd.com>; rafael.j.wysocki@intel.com;
> viresh.kumar@linaro.org; Huang, Ray <Ray.Huang@amd.com>
> Cc: Sharma, Deepak <Deepak.Sharma@amd.com>; Limonciello, Mario
> <Mario.Limonciello@amd.com>; Fontenot, Nathan
> <Nathan.Fontenot@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Su, Jinzhou (Joe) <Jinzhou.Su@amd.com>;
> Huang, Shimmer <Shimmer.Huang@amd.com>; Du, Xiaojian
> <Xiaojian.Du@amd.com>; Meng, Li (Jassmine) <Li.Meng@amd.com>; linux-
> pm@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into
> pstate scope for powersave governor
> 
> On 7/9/22 09:19, Perry Yuan wrote:
> > The patch will fix the invalid desired perf value for powersave
> > governor. This issue is found when testing on one AMD EPYC system, the
> > actual des_perf is smaller than the min_perf value, that is invalid
> > value. because the min_perf is the lowest_perf system can support in
> > idle state.
> >
> > Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
> > ---
> >  drivers/cpufreq/amd-pstate.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/cpufreq/amd-pstate.c
> > b/drivers/cpufreq/amd-pstate.c index 7c51f4125263..8a2b6ad9b8c0
> 100644
> > --- a/drivers/cpufreq/amd-pstate.c
> > +++ b/drivers/cpufreq/amd-pstate.c
> > @@ -265,6 +265,7 @@ static void amd_pstate_update(struct
> amd_cpudata *cpudata, u32 min_perf,
> >  	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
> >  	u64 value = prev;
> >
> > +	des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
> 
> You should also update amd_pstate_adjust_perf() to remove the clamp_t()
> call now that it is done here.
> 
> -Nathan

I missed that, changed into V3.
Thank you!

Perry.
> 
> >  	value &= ~AMD_CPPC_MIN_PERF(~0L);
> >  	value |= AMD_CPPC_MIN_PERF(min_perf);
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-12  9:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-09 14:19 [PATCH v2 07/14] cpufreq: amd_pstate: map desired perf into pstate scope for powersave governor Perry Yuan
2022-07-11 19:33 ` Nathan Fontenot
2022-07-12  9:28   ` Yuan, Perry

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.