linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Kristen Carlson Accardi <kristen@linux.intel.com>,
	linux-kernel@vger.kernel.org,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpufreq, intel_pstate, set max_sysfs_pct and min_sysfs_pct on governor switch
Date: Wed, 07 Oct 2015 10:50:17 -0400	[thread overview]
Message-ID: <56153129.3080905@redhat.com> (raw)
In-Reply-To: <56150D80.8040609@redhat.com>



On 10/07/2015 08:18 AM, Prarit Bhargava wrote:
> 
> 
> On 10/06/2015 07:06 PM, Rafael J. Wysocki wrote:
>> On Wednesday, October 07, 2015 12:43:55 AM Rafael J. Wysocki wrote:
>>> On Tuesday, October 06, 2015 05:49:07 PM Prarit Bhargava wrote:
> 
> <snip>
> 
>>>>
>>>> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
>>>> index 3af9dd7..bb24458 100644
>>>> --- a/drivers/cpufreq/intel_pstate.c
>>>> +++ b/drivers/cpufreq/intel_pstate.c
>>>> @@ -986,6 +986,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
>>>>  	if (!policy->cpuinfo.max_freq)
>>>>  		return -ENODEV;
>>>>  
>>>> +	limits.min_sysfs_pct = 0;
>>>> +	limits.max_sysfs_pct = 100;
>>>> +
>>>>  	if (policy->policy == CPUFREQ_POLICY_PERFORMANCE &&
>>>>  	    policy->max >= policy->cpuinfo.max_freq) {
>>>>  		limits.min_policy_pct = 100;
>>>> @@ -1004,9 +1007,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
>>>>  	limits.max_policy_pct = clamp_t(int, limits.max_policy_pct, 0 , 100);
>>>>  
>>>>  	/* Normalize user input to [min_policy_pct, max_policy_pct] */
>>>> -	limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct);
>>>> +	limits.min_perf_pct = limits.min_policy_pct;
>>>>  	limits.min_perf_pct = min(limits.max_policy_pct, limits.min_perf_pct);
>>>> -	limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
>>>> +	limits.max_perf_pct = limits.max_sysfs_pct;
>>
>> On a second thought, isn't that always 100?  If so, doesn't it basically discard
>> limits.max_policy_pct?
> 
> Wow :)  I think you're right and that definitely was an unintended consequence
> of this patch.  I also see that I can clean up the intel_pstate_set_policy()
> code a bit more.  I'll submit a 2-part v2.

Kristen,

There is a question here and I'm going to need your input on the answer.  The
question is whether or not a user can exceed the max_policy_pct or drop below
the min_policy_pct values via sysfs?

If "No, a user should not be able to exceed or go below those values", then IMO

limits.max_sysfs_pct should default to limits.max_policy_pct, and
limits.min_sysfs_pct should default to limits.min_policy_pct.

and I will adjust my patch accordingly.

P.

      reply	other threads:[~2015-10-07 14:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 21:49 [PATCH] cpufreq, intel_pstate, set max_sysfs_pct and min_sysfs_pct on governor switch Prarit Bhargava
2015-10-06 22:43 ` Rafael J. Wysocki
2015-10-06 23:06   ` Rafael J. Wysocki
2015-10-07  6:51     ` Doug Smythies
2015-10-07  9:59       ` Prarit Bhargava
2015-10-07 14:04         ` Doug Smythies
2015-10-07 14:10           ` Prarit Bhargava
2015-10-07 15:40             ` Doug Smythies
2015-10-07 15:46               ` Prarit Bhargava
2015-10-07 18:52                 ` Doug Smythies
2015-10-07 20:40                   ` Prarit Bhargava
2015-10-07 21:31                   ` Prarit Bhargava
2015-10-07 22:05                     ` Rafael J. Wysocki
2015-10-07 22:26                       ` Doug Smythies
2015-10-07 23:17                         ` Prarit Bhargava
2015-10-08  0:13                         ` Prarit Bhargava
2015-10-07 23:08                       ` Prarit Bhargava
2015-10-07 14:34           ` Prarit Bhargava
2015-10-07 11:38     ` Prarit Bhargava
2015-10-07 12:18     ` Prarit Bhargava
2015-10-07 14:50       ` Prarit Bhargava [this message]

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=56153129.3080905@redhat.com \
    --to=prarit@redhat.com \
    --cc=kristen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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 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).