All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@rjwysocki.net, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] cpufreq: powernv: Adding fast_switch for schedutil
Date: Mon, 7 Nov 2016 13:02:04 +0530	[thread overview]
Message-ID: <d2bbacea-3401-01ab-0933-f9ed628df502@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161104063322.GA3414@vireshk-i7>

Thanks Viresh for taking a look at it.

I will make the mentioned changes in the next version of the patch.


Regards

Akshay Adiga


On 11/04/2016 12:03 PM, Viresh Kumar wrote:
> 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@linux.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

WARNING: multiple messages have this Message-ID (diff)
From: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linuxppc-dev@lists.ozlabs.org, rjw@rjwysocki.net,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/2] cpufreq: powernv: Adding fast_switch for schedutil
Date: Mon, 7 Nov 2016 13:02:04 +0530	[thread overview]
Message-ID: <d2bbacea-3401-01ab-0933-f9ed628df502@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161104063322.GA3414@vireshk-i7>

Thanks Viresh for taking a look at it.

I will make the mentioned changes in the next version of the patch.


Regards

Akshay Adiga


On 11/04/2016 12:03 PM, Viresh Kumar wrote:
> 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@linux.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

  reply	other threads:[~2016-11-07  7:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04  5:27 [PATCH 1/2] cpufreq: powernv: Adding fast_switch for schedutil Akshay Adiga
2016-11-04  5:27 ` [PATCH 2/2] cpufreq: powernv: Use PMSR to verify global and local pstate Akshay Adiga
2016-11-04  6:41   ` Viresh Kumar
2016-11-07  7:32     ` Akshay Adiga
2016-11-04  6:33 ` [PATCH 1/2] cpufreq: powernv: Adding fast_switch for schedutil Viresh Kumar
2016-11-07  7:32   ` Akshay Adiga [this message]
2016-11-07  7:32     ` Akshay Adiga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2bbacea-3401-01ab-0933-f9ed628df502@linux.vnet.ibm.com \
    --to=akshay.adiga@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.