From: "Doug Smythies" <dsmythies@telus.net>
To: 'Prarit Bhargava' <prarit@redhat.com>
Cc: 'Kristen Carlson Accardi' <kristen@linux.intel.com>,
linux-kernel@vger.kernel.org,
'Viresh Kumar' <viresh.kumar@linaro.org>,
linux-pm@vger.kernel.org,
"'Rafael J. Wysocki'" <rjw@rjwysocki.net>,
Doug Smythies <dsmythies@telus.net>
Subject: RE: [PATCH] cpufreq, intel_pstate, set max_sysfs_pct and min_sysfs_pct on governor switch
Date: Tue, 6 Oct 2015 23:51:28 -0700 [thread overview]
Message-ID: <002701d100cc$98cb8c60$ca62a520$@net> (raw)
In-Reply-To: <1594304.lVcRDcB3yL@vostro.rjw.lan>
On 2015.09.06 16:48 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:
>>> Intel CPUs will not enter higher p-states when after switching from the
>>> performance governor to the powersave governor, until
>>> /sys/devices/system/cpu/intel_pstate/min_perf_pct is set to a low value.
It works properly for me.
Isn't the root issue here an incompatibility between
tools/power/cpupower/utils/cpufreq-set.c and
drivers/cpufreq/intel_pstate.c?
(see experiment results below, where I do not use "cpupower")
I am not familiar with tools/power/cpupower/utils/cpufreq-set.c, but will
look at it more tomorrow.
>>> This differs from previous behaviour in which a switch to the powersave
>>> governor would result in a low default value for min_perf_pct.
>>>
>>> The behavior of the powersave governor changed after commit a04759924e25
>>> ("[cpufreq] intel_pstate: honor user space min_perf_pct override on
>>> resume"). The commit introduced tracking of performance percentage
>>> changes via sysfs in order to restore userspace changes during
>>> suspend/resume. The problem occurs because the global values of the newly
>>> introduced max_sysfs_pct and min_sysfs_pct are not reset on a governor
>>> change and this causes the new governor to inherit the previous governor's
>>> settings.
>>>
>>> This patch sets max_sysfs_pct to 100 and min_sysfs_pct to 0 on a governor
>>> change which fixes the problem with governor switching. These changes
>>> also make the initial calculations for max_perf_pct and min_perf_pct
>>> slightly simpler.
>>>
>>> Before patch:
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g performance
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g powersave
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
And before patch I get, using primitives and not cpupower:
Executive Summary: Everything works fine (or at least as I thought it was supposed to).
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
root@s15:/home/doug/temp# echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
root@s15:/home/doug/temp# echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:100
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:performance
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
>>>
>>> After patch:
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g performance
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g powersave
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 14
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
>>>
And after the patch I get, using primitives and not cpupower:
Executive Summary: Settings go back to default, and user settings are lost.
This is not how I thought things were supposed to behave, but I'm not actually sure.
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
root@s15:/home/doug/temp# echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
root@s15:/home/doug/temp# echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:performance
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:100
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
>>> Also note that I have tested suspend/resume (using CONFIG_PM_DEBUG):
>>> [root@intel-skylake-y-01 power]# echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/*_perf_pct
>>> 100
>>> 50
>>> [root@intel-skylake-y-01 power]# echo devices > /sys/power/pm_test
>>> [root@intel-skylake-y-01 power]# echo platform > /sys/power/disk
>>> [root@intel-skylake-y-01 power]# echo disk > /sys/power/state
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/*_perf_pct
>>> 100
>>> 50
Before Patch, I get:
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# pm-suspend
...
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
After Patch, I get:
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# pm-suspend
...
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
>>>
>>> Fixes: a04759924e25 ("[cpufreq] intel_pstate: honor user space min_perf_pct override on resume")
>>> Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
>>> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
>>> Cc: Viresh Kumar <viresh.kumar@linaro.org>
>>> Cc: linux-pm@vger.kernel.org
>>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>>> ---
>>> drivers/cpufreq/intel_pstate.c | 7 +++++--
>>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> 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?
>
Yes, I think so, see above.
>>> limits.max_perf_pct = max(limits.min_policy_pct, limits.max_perf_pct);
>>>
>>> /* Make sure min_perf_pct <= max_perf_pct */
>>>
Kernels used: 4.3-rc4 and same plus this patch.
WARNING: multiple messages have this Message-ID (diff)
From: "Doug Smythies" <dsmythies@telus.net>
To: "'Prarit Bhargava'" <prarit@redhat.com>
Cc: "'Kristen Carlson Accardi'" <kristen@linux.intel.com>,
<linux-kernel@vger.kernel.org>,
"'Viresh Kumar'" <viresh.kumar@linaro.org>,
<linux-pm@vger.kernel.org>,
"'Rafael J. Wysocki'" <rjw@rjwysocki.net>,
"Doug Smythies" <dsmythies@telus.net>
Subject: RE: [PATCH] cpufreq, intel_pstate, set max_sysfs_pct and min_sysfs_pct on governor switch
Date: Tue, 6 Oct 2015 23:51:28 -0700 [thread overview]
Message-ID: <002701d100cc$98cb8c60$ca62a520$@net> (raw)
In-Reply-To: <1594304.lVcRDcB3yL@vostro.rjw.lan>
On 2015.09.06 16:48 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:
>>> Intel CPUs will not enter higher p-states when after switching from the
>>> performance governor to the powersave governor, until
>>> /sys/devices/system/cpu/intel_pstate/min_perf_pct is set to a low value.
It works properly for me.
Isn't the root issue here an incompatibility between
tools/power/cpupower/utils/cpufreq-set.c and
drivers/cpufreq/intel_pstate.c?
(see experiment results below, where I do not use "cpupower")
I am not familiar with tools/power/cpupower/utils/cpufreq-set.c, but will
look at it more tomorrow.
>>> This differs from previous behaviour in which a switch to the powersave
>>> governor would result in a low default value for min_perf_pct.
>>>
>>> The behavior of the powersave governor changed after commit a04759924e25
>>> ("[cpufreq] intel_pstate: honor user space min_perf_pct override on
>>> resume"). The commit introduced tracking of performance percentage
>>> changes via sysfs in order to restore userspace changes during
>>> suspend/resume. The problem occurs because the global values of the newly
>>> introduced max_sysfs_pct and min_sysfs_pct are not reset on a governor
>>> change and this causes the new governor to inherit the previous governor's
>>> settings.
>>>
>>> This patch sets max_sysfs_pct to 100 and min_sysfs_pct to 0 on a governor
>>> change which fixes the problem with governor switching. These changes
>>> also make the initial calculations for max_perf_pct and min_perf_pct
>>> slightly simpler.
>>>
>>> Before patch:
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g performance
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g powersave
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
And before patch I get, using primitives and not cpupower:
Executive Summary: Everything works fine (or at least as I thought it was supposed to).
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
root@s15:/home/doug/temp# echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
root@s15:/home/doug/temp# echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:100
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:performance
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
>>>
>>> After patch:
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g performance
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
>>> [root@intel-skylake-y-01 power]# cpupower frequency-set -g powersave
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> 14
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
>>> 100
>>>
And after the patch I get, using primitives and not cpupower:
Executive Summary: Settings go back to default, and user settings are lost.
This is not how I thought things were supposed to behave, but I'm not actually sure.
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
root@s15:/home/doug/temp# echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
root@s15:/home/doug/temp# echo 80 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:performance
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:performance
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:100
root@s15:/home/doug/temp# for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" > $file; done
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor:powersave
...
/sys/devices/system/cpu/cpu7/cpufreq/scaling_governor:powersave
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
>>> Also note that I have tested suspend/resume (using CONFIG_PM_DEBUG):
>>> [root@intel-skylake-y-01 power]# echo 50 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/*_perf_pct
>>> 100
>>> 50
>>> [root@intel-skylake-y-01 power]# echo devices > /sys/power/pm_test
>>> [root@intel-skylake-y-01 power]# echo platform > /sys/power/disk
>>> [root@intel-skylake-y-01 power]# echo disk > /sys/power/state
>>> [root@intel-skylake-y-01 power]# cat /sys/devices/system/cpu/intel_pstate/*_perf_pct
>>> 100
>>> 50
Before Patch, I get:
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# pm-suspend
...
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
After Patch, I get:
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:80
/sys/devices/system/cpu/intel_pstate/min_perf_pct:50
root@s15:/home/doug/temp# pm-suspend
...
root@s15:/home/doug/temp# grep . /sys/devices/system/cpu/intel_pstate/*_perf_*
/sys/devices/system/cpu/intel_pstate/max_perf_pct:100
/sys/devices/system/cpu/intel_pstate/min_perf_pct:42
>>>
>>> Fixes: a04759924e25 ("[cpufreq] intel_pstate: honor user space min_perf_pct override on resume")
>>> Cc: Kristen Carlson Accardi <kristen@linux.intel.com>
>>> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
>>> Cc: Viresh Kumar <viresh.kumar@linaro.org>
>>> Cc: linux-pm@vger.kernel.org
>>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>>> ---
>>> drivers/cpufreq/intel_pstate.c | 7 +++++--
>>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> 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?
>
Yes, I think so, see above.
>>> limits.max_perf_pct = max(limits.min_policy_pct, limits.max_perf_pct);
>>>
>>> /* Make sure min_perf_pct <= max_perf_pct */
>>>
Kernels used: 4.3-rc4 and same plus this patch.
next prev parent reply other threads:[~2015-10-07 6:51 UTC|newest]
Thread overview: 26+ 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 [this message]
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:04 ` Doug Smythies
2015-10-07 14:10 ` Prarit Bhargava
2015-10-07 15:40 ` Doug Smythies
2015-10-07 15:40 ` Doug Smythies
2015-10-07 15:46 ` Prarit Bhargava
2015-10-07 18:52 ` Doug Smythies
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 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
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='002701d100cc$98cb8c60$ca62a520$@net' \
--to=dsmythies@telus.net \
--cc=kristen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=prarit@redhat.com \
--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.