linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Jin <joe.jin@oracle.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	Neil Gu <qing.gu@oracle.com>,
	cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ACPI: update user_policy.max when _PPC updated
Date: Thu, 06 Jun 2013 21:29:27 +0800	[thread overview]
Message-ID: <51B08EB7.8080702@oracle.com> (raw)
In-Reply-To: <42861210.QMFsUVH8RU@vostro.rjw.lan>

On 06/06/13 19:06, Rafael J. Wysocki wrote:
> On Thursday, June 06, 2013 08:27:08 AM Joe Jin wrote:
>> On 06/06/13 04:40, Rafael J. Wysocki wrote:
>>> On Wednesday, June 05, 2013 08:52:52 AM Joe Jin wrote:
>>>> When _PPC changed dynamically the user_policy.max will not be updated,
>>>> this prevent CPU run on the highest frequency.
>>>
>>> Why should the user setting be always related to the current maximum available
>>> frequency?  What if the user sets the limit for power capping purposes?
>>
>> cpufreq_update_policy() get policy->max from user_policy.max:
>>
>> 1782 int cpufreq_update_policy(unsigned int cpu)
>> 1783 {
>> [...]
>> 1800         policy.min = data->user_policy.min;
>> 1801         policy.max = data->user_policy.max;
>> 1802         policy.policy = data->user_policy.policy;
>> 1803         policy.governor = data->user_policy.governor;
>> [...]
>> 1819         ret = __cpufreq_set_policy(data, &policy);
>> [...]
>>
>> /sys/devices/system/cpu/cpu$/cpufreq/scaling_max_freq using policy->max 
>> and user_policy->max, when update it, so I think _PPC changes also need
>> to update these two?
> 
> Yes, if policy.max happens to be greater that the maximum available frequency,
> then (and only then) it probably should be updated.  It should never be bumped
> up, though.

Does this means if I enabled hardcap before kernel boot up, and later system brought
up and I disabled hardcap, I has to enlarge the max frequency manually?

Thanks,
Joe

> 
> Thanks,
> Rafael
> 
> 
>>>> Signed-off-by: Joe Jin <joe.jin@oracle.com>
>>>> Cc: Rafael J. Wysocki <rjw@sisk.pl>
>>>> Cc: Viresh Kumar <viresh.kumar@linaro.org>
>>>> ---
>>>>  drivers/acpi/processor_perflib.c | 17 ++++++++++++++++-
>>>>  1 file changed, 16 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
>>>> index e854582..e01aa7d 100644
>>>> --- a/drivers/acpi/processor_perflib.c
>>>> +++ b/drivers/acpi/processor_perflib.c
>>>> @@ -180,6 +180,7 @@ static void acpi_processor_ppc_ost(acpi_handle handle, int status)
>>>>  int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag)
>>>>  {
>>>>  	int ret;
>>>> +	unsigned int saved = (unsigned int)pr->performance_platform_limit;
>>>>  
>>>>  	if (ignore_ppc) {
>>>>  		/*
>>>> @@ -204,8 +205,22 @@ int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag)
>>>>  	}
>>>>  	if (ret < 0)
>>>>  		return (ret);
>>>> -	else
>>>> +	else {
>>>> +		unsigned int ppc = (unsigned int)pr->performance_platform_limit;
>>>> +
>>>> +		if (saved != ppc) {
>>>> +			struct cpufreq_policy *policy;
>>>> +
>>>> +			policy = cpufreq_cpu_get(pr->id);
>>>> +			if (likely(policy))
>>>> +				policy->user_policy.max =
>>>> +					pr->performance->states[ppc].
>>>> +					core_frequency * 1000;
>>>> +			cpufreq_cpu_put(policy);
>>>> +		}
>>>> +
>>>>  		return cpufreq_update_policy(pr->id);
>>>> +	}
>>>>  }
>>>>  
>>>>  int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
>>>>
>>
>>
>>


-- 
Oracle <http://www.oracle.com>
Joe Jin | Software Development Senior Manager | +8610.6106.5624
ORACLE | Linux and Virtualization
No. 24 Zhongguancun Software Park, Haidian District | 100193 Beijing 

  reply	other threads:[~2013-06-06 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05  0:52 [PATCH] ACPI: update user_policy.max when _PPC updated Joe Jin
2013-06-05 20:40 ` Rafael J. Wysocki
2013-06-06  0:27   ` Joe Jin
2013-06-06 11:06     ` Rafael J. Wysocki
2013-06-06 13:29       ` Joe Jin [this message]
2013-06-06 19:54         ` Rafael J. Wysocki
2013-06-07  1:48           ` Joe Jin

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=51B08EB7.8080702@oracle.com \
    --to=joe.jin@oracle.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=qing.gu@oracle.com \
    --cc=rjw@sisk.pl \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).