lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 8 Sep 2021 13:20:58 -0500
From:   "Fontenot, Nathan" <Nathan.Fontenot@....com>
To:     Huang Rui <ray.huang@....com>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Shuah Khan <skhan@...uxfoundation.org>,
        Borislav Petkov <bp@...e.de>, Ingo Molnar <mingo@...nel.org>,
        linux-pm@...r.kernel.org
Cc:     Deepak Sharma <deepak.sharma@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Mario Limonciello <mario.limonciello@....com>,
        Jinzhou Su <Jinzhou.Su@....com>,
        Xiaojian Du <Xiaojian.Du@....com>,
        linux-kernel@...r.kernel.org, x86@...nel.org
Subject: Re: [PATCH 11/19] cpufreq: amd: add amd-pstate performance attributes

On 9/8/2021 9:59 AM, Huang Rui wrote:
> Introduce sysfs attributes to get the different level amd-pstate
> performances.
> 
> Signed-off-by: Huang Rui <ray.huang@....com>
> ---
>  drivers/cpufreq/amd-pstate.c | 66 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 3c727a22cb69..9c60388d45ed 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -647,6 +647,62 @@ static ssize_t show_amd_pstate_min_freq(struct cpufreq_policy *policy, char *buf
>  	return ret;
>  }
>  
> +static ssize_t
> +show_amd_pstate_highest_perf(struct cpufreq_policy *policy, char *buf)

Here (and in the other functions) the function return value and name should
be on the same line.

> +{
> +	int ret = 0;
> +	u32 perf;
> +	struct amd_cpudata *cpudata = policy->driver_data;
> +
> +	perf = READ_ONCE(cpudata->highest_perf);
> +
> +	ret += sprintf(&buf[ret], "%u\n", perf);
> +
> +	return ret;

Same comment as the previous patch here and in the functions below, just do

	return sprintf(&buf[ret], "%u\n", perf);

and get rid of the intermediary 'ret' variable.

-Nathan

> +}
> +
> +static ssize_t
> +show_amd_pstate_nominal_perf(struct cpufreq_policy *policy, char *buf)
> +{
> +	int ret = 0;
> +	u32 perf;
> +	struct amd_cpudata *cpudata = policy->driver_data;
> +
> +	perf = READ_ONCE(cpudata->nominal_perf);
> +
> +	ret += sprintf(&buf[ret], "%u\n", perf);
> +
> +	return ret;
> +}
> +
> +static ssize_t
> +show_amd_pstate_lowest_nonlinear_perf(struct cpufreq_policy *policy, char *buf)
> +{
> +	int ret = 0;
> +	u32 perf;
> +	struct amd_cpudata *cpudata = policy->driver_data;
> +
> +	perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
> +
> +	ret += sprintf(&buf[ret], "%u\n", perf);
> +
> +	return ret;
> +}
> +
> +static ssize_t
> +show_amd_pstate_lowest_perf(struct cpufreq_policy *policy, char *buf)
> +{
> +	int ret = 0;
> +	u32 perf;
> +	struct amd_cpudata *cpudata = policy->driver_data;
> +
> +	perf = READ_ONCE(cpudata->lowest_perf);
> +
> +	ret += sprintf(&buf[ret], "%u\n", perf);
> +
> +	return ret;
> +}
> +
>  static ssize_t show_is_amd_pstate_enabled(struct cpufreq_policy *policy,
>  					  char *buf)
>  {
> @@ -654,17 +710,27 @@ static ssize_t show_is_amd_pstate_enabled(struct cpufreq_policy *policy,
>  }
>  
>  cpufreq_freq_attr_ro(is_amd_pstate_enabled);
> +
>  cpufreq_freq_attr_ro(amd_pstate_max_freq);
>  cpufreq_freq_attr_ro(amd_pstate_nominal_freq);
>  cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq);
>  cpufreq_freq_attr_ro(amd_pstate_min_freq);
>  
> +cpufreq_freq_attr_ro(amd_pstate_highest_perf);
> +cpufreq_freq_attr_ro(amd_pstate_nominal_perf);
> +cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_perf);
> +cpufreq_freq_attr_ro(amd_pstate_lowest_perf);
> +
>  static struct freq_attr *amd_pstate_attr[] = {
>  	&is_amd_pstate_enabled,
>  	&amd_pstate_max_freq,
>  	&amd_pstate_nominal_freq,
>  	&amd_pstate_lowest_nonlinear_freq,
>  	&amd_pstate_min_freq,
> +	&amd_pstate_highest_perf,
> +	&amd_pstate_nominal_perf,
> +	&amd_pstate_lowest_nonlinear_perf,
> +	&amd_pstate_lowest_perf,
>  	NULL,
>  };
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ