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: <20161104063322.GA3414@vireshk-i7>
Date:   Fri, 4 Nov 2016 12:03:22 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Akshay Adiga <akshay.adiga@...ux.vnet.ibm.com>
Cc:     rjw@...ysocki.net, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH 1/2] cpufreq: powernv: Adding fast_switch for schedutil

On 04-11-16, 10:57, Akshay Adiga wrote:
> Adding fast_switch which does light weight operation to
> set the desired pstate.
> 
> Signed-off-by: Akshay Adiga <akshay.adiga@...ux.vnet.ibm.com>
> ---
>  drivers/cpufreq/powernv-cpufreq.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
> index d3ffde8..09a0496 100644
> --- a/drivers/cpufreq/powernv-cpufreq.c
> +++ b/drivers/cpufreq/powernv-cpufreq.c
> @@ -752,9 +752,12 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy)
>  	spin_lock_init(&gpstates->gpstate_lock);
>  	ret = cpufreq_table_validate_and_show(policy, powernv_freqs);
>  
> -	if (ret < 0)
> +	if (ret < 0) {
>  		kfree(policy->driver_data);
> +		return ret;
> +	}
>  
> +	policy->fast_switch_possible = true;
>  	return ret;
>  }
>  
> @@ -897,6 +900,22 @@ static void powernv_cpufreq_stop_cpu(struct cpufreq_policy *policy)
>  	del_timer_sync(&gpstates->timer);
>  }
>  
> +static unsigned int powernv_fast_switch(struct cpufreq_policy *policy,
> +					unsigned int target_freq)
> +{
> +	int index;
> +	struct powernv_smp_call_data freq_data;
> +
> +	index = cpufreq_table_find_index_dl(policy, target_freq);
> +	if (index < 0 || index >= powernv_pstate_info.nr_pstates)
> +		return CPUFREQ_ENTRY_INVALID;

I don't think such a check is required at all. It wouldn't happen without a BUG
in kernel.

> +	freq_data.pstate_id = powernv_freqs[index].driver_data;
> +	freq_data.gpstate_id = powernv_freqs[index].driver_data;
> +	set_pstate(&freq_data);
> +
> +	return powernv_freqs[index].frequency;
> +}
> +
>  static struct cpufreq_driver powernv_cpufreq_driver = {
>  	.name		= "powernv-cpufreq",
>  	.flags		= CPUFREQ_CONST_LOOPS,
> @@ -904,6 +923,7 @@ static struct cpufreq_driver powernv_cpufreq_driver = {
>  	.exit		= powernv_cpufreq_cpu_exit,
>  	.verify		= cpufreq_generic_frequency_table_verify,
>  	.target_index	= powernv_cpufreq_target_index,
> +	.fast_switch	= powernv_fast_switch,
>  	.get		= powernv_cpufreq_get,
>  	.stop_cpu	= powernv_cpufreq_stop_cpu,
>  	.attr		= powernv_cpu_freq_attr,
> -- 
> 2.7.4

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ