All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] amd-pstate: Only print supported epp values for performance governor
@ 2023-11-03  9:48 Ayush Jain
  2023-11-03  9:59 ` Huang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Ayush Jain @ 2023-11-03  9:48 UTC (permalink / raw)
  To: ray.huang, rafael, viresh.kumar, Perry.Yuan, wyes.karny,
	Mario.Limonciello
  Cc: linux-pm, linux-kernel, Ayush Jain

show_energy_performance_available_preferences() to show only supported
values which is performance in performance governor policy.

-------Before--------
$ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
amd-pstate-epp
$ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
performance
$ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
performance
$ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences
default performance balance_performance balance_power power

-------After--------
$ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
amd-pstate-epp
$ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
performance
$ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
performance
$ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences
performance

Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors")

Suggested-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
Reviewed-by: Wyes Karny <wyes.karny@amd.com>

---
 drivers/cpufreq/amd-pstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 9a1e194d5cf8..e6c5a57662e4 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -850,11 +850,16 @@ static ssize_t show_energy_performance_available_preferences(
 {
 	int i = 0;
 	int offset = 0;
+	struct amd_cpudata *cpudata = policy->driver_data;
+
+	if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
+		return sysfs_emit_at(buf, offset, "%s\n",
+				energy_perf_strings[EPP_INDEX_PERFORMANCE]);
 
 	while (energy_perf_strings[i] != NULL)
 		offset += sysfs_emit_at(buf, offset, "%s ", energy_perf_strings[i++]);
 
-	sysfs_emit_at(buf, offset, "\n");
+	offset += sysfs_emit_at(buf, offset, "\n");
 
 	return offset;
 }
-- 
2.34.1


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

* Re: [RESEND PATCH] amd-pstate: Only print supported epp values for performance governor
  2023-11-03  9:48 [RESEND PATCH] amd-pstate: Only print supported epp values for performance governor Ayush Jain
@ 2023-11-03  9:59 ` Huang Rui
  2023-11-29 21:06   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Rui @ 2023-11-03  9:59 UTC (permalink / raw)
  To: Jain, Ayush
  Cc: rafael, viresh.kumar, Yuan, Perry, Karny, Wyes, Limonciello,
	Mario, linux-pm, linux-kernel

On Fri, Nov 03, 2023 at 05:48:15PM +0800, Jain, Ayush wrote:
> show_energy_performance_available_preferences() to show only supported
> values which is performance in performance governor policy.
> 
> -------Before--------
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
> amd-pstate-epp
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
> performance
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences
> default performance balance_performance balance_power power
> 
> -------After--------
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
> amd-pstate-epp
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
> performance
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
> performance
> $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences
> performance
> 
> Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors")
> 
> Suggested-by: Wyes Karny <wyes.karny@amd.com>
> Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
> Reviewed-by: Wyes Karny <wyes.karny@amd.com>

Nice catch, thanks for the fix.

Acked-by: Huang Rui <ray.huang@amd.com>

> 
> ---
>  drivers/cpufreq/amd-pstate.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 9a1e194d5cf8..e6c5a57662e4 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -850,11 +850,16 @@ static ssize_t show_energy_performance_available_preferences(
>  {
>  	int i = 0;
>  	int offset = 0;
> +	struct amd_cpudata *cpudata = policy->driver_data;
> +
> +	if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
> +		return sysfs_emit_at(buf, offset, "%s\n",
> +				energy_perf_strings[EPP_INDEX_PERFORMANCE]);
>  
>  	while (energy_perf_strings[i] != NULL)
>  		offset += sysfs_emit_at(buf, offset, "%s ", energy_perf_strings[i++]);
>  
> -	sysfs_emit_at(buf, offset, "\n");
> +	offset += sysfs_emit_at(buf, offset, "\n");
>  
>  	return offset;
>  }
> -- 
> 2.34.1
> 

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

* Re: [RESEND PATCH] amd-pstate: Only print supported epp values for performance governor
  2023-11-03  9:59 ` Huang Rui
@ 2023-11-29 21:06   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2023-11-29 21:06 UTC (permalink / raw)
  To: Huang Rui, Jain, Ayush
  Cc: rafael, viresh.kumar, Yuan, Perry, Karny, Wyes, Limonciello,
	Mario, linux-pm, linux-kernel

On Fri, Nov 3, 2023 at 11:00 AM Huang Rui <ray.huang@amd.com> wrote:
>
> On Fri, Nov 03, 2023 at 05:48:15PM +0800, Jain, Ayush wrote:
> > show_energy_performance_available_preferences() to show only supported
> > values which is performance in performance governor policy.
> >
> > -------Before--------
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
> > amd-pstate-epp
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
> > performance
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
> > performance
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences
> > default performance balance_performance balance_power power
> >
> > -------After--------
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver
> > amd-pstate-epp
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
> > performance
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
> > performance
> > $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences
> > performance
> >
> > Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors")
> >
> > Suggested-by: Wyes Karny <wyes.karny@amd.com>
> > Signed-off-by: Ayush Jain <ayush.jain3@amd.com>
> > Reviewed-by: Wyes Karny <wyes.karny@amd.com>
>
> Nice catch, thanks for the fix.
>
> Acked-by: Huang Rui <ray.huang@amd.com>

Applied as 6.7-rc material, thanks!

> >
> > ---
> >  drivers/cpufreq/amd-pstate.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> > index 9a1e194d5cf8..e6c5a57662e4 100644
> > --- a/drivers/cpufreq/amd-pstate.c
> > +++ b/drivers/cpufreq/amd-pstate.c
> > @@ -850,11 +850,16 @@ static ssize_t show_energy_performance_available_preferences(
> >  {
> >       int i = 0;
> >       int offset = 0;
> > +     struct amd_cpudata *cpudata = policy->driver_data;
> > +
> > +     if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
> > +             return sysfs_emit_at(buf, offset, "%s\n",
> > +                             energy_perf_strings[EPP_INDEX_PERFORMANCE]);
> >
> >       while (energy_perf_strings[i] != NULL)
> >               offset += sysfs_emit_at(buf, offset, "%s ", energy_perf_strings[i++]);
> >
> > -     sysfs_emit_at(buf, offset, "\n");
> > +     offset += sysfs_emit_at(buf, offset, "\n");
> >
> >       return offset;
> >  }
> > --
> > 2.34.1
> >

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

end of thread, other threads:[~2023-11-29 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-03  9:48 [RESEND PATCH] amd-pstate: Only print supported epp values for performance governor Ayush Jain
2023-11-03  9:59 ` Huang Rui
2023-11-29 21:06   ` Rafael J. Wysocki

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.