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]
Message-ID: <20190614171450.GQ137143@google.com>
Date:   Fri, 14 Jun 2019 10:14:50 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Viresh Kumar <viresh.kumar@...aro.org>
Cc:     Rafael Wysocki <rjw@...ysocki.net>, linux-pm@...r.kernel.org,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Qais.Yousef@....com, juri.lelli@...il.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V3 5/5] cpufreq: Add QoS requests for userspace
 constraints

Hi Viresh,

On Mon, Jun 10, 2019 at 04:21:36PM +0530, Viresh Kumar wrote:
> This implements QoS requests to manage userspace configuration of min
> and max frequency.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
>  drivers/cpufreq/cpufreq.c | 92 +++++++++++++++++++--------------------
>  include/linux/cpufreq.h   |  8 +---
>  2 files changed, 47 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 547d221b2ff2..ff754981fcb4 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -720,23 +720,15 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf)
>  static ssize_t store_##file_name					\
>  (struct cpufreq_policy *policy, const char *buf, size_t count)		\
>  {									\
> -	int ret, temp;							\
> -	struct cpufreq_policy new_policy;				\
> +	unsigned long val;						\
> +	int ret;							\
>  									\
> -	memcpy(&new_policy, policy, sizeof(*policy));			\
> -	new_policy.min = policy->user_policy.min;			\
> -	new_policy.max = policy->user_policy.max;			\
> -									\
> -	ret = sscanf(buf, "%u", &new_policy.object);			\
> +	ret = sscanf(buf, "%lu", &val);					\
>  	if (ret != 1)							\
>  		return -EINVAL;						\
>  									\
> -	temp = new_policy.object;					\
> -	ret = cpufreq_set_policy(policy, &new_policy);		\
> -	if (!ret)							\
> -		policy->user_policy.object = temp;			\
> -									\
> -	return ret ? ret : count;					\
> +	ret = dev_pm_qos_update_request(policy->object##_freq_req, val);\
> +	return ret && ret != 1 ? ret : count;				\

nit: I wonder if

  return (ret >= 0) ? count : ret;

would be clearer.

Other than that:

Reviewed-by: Matthias Kaehlcke <mka@...omium.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ