* [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
@ 2015-09-04 10:58 Seiichi Ikarashi
2015-09-07 9:00 ` Chen, Yu C
0 siblings, 1 reply; 6+ messages in thread
From: Seiichi Ikarashi @ 2015-09-04 10:58 UTC (permalink / raw)
To: kristen, rafael.j.wysocki; +Cc: linux-pm
Add some value check to prevent a reversal, max_perf_pct < min_perf_pct.
Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
---
drivers/cpufreq/intel_pstate.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index fcb929e..03dda19 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -423,6 +423,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct attribute *b,
limits.max_sysfs_pct = clamp_t(int, input, 0 , 100);
limits.max_perf_pct = min(limits.max_policy_pct, limits.max_sysfs_pct);
+ limits.max_perf_pct = max(limits.max_perf_pct, limits.min_perf_pct);
limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
if (hwp_active)
@@ -442,6 +443,7 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct attribute *b,
limits.min_sysfs_pct = clamp_t(int, input, 0 , 100);
limits.min_perf_pct = max(limits.min_policy_pct, limits.min_sysfs_pct);
+ limits.min_perf_pct = min(limits.min_perf_pct, limits.max_perf_pct);
limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
if (hwp_active)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
2015-09-04 10:58 [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct Seiichi Ikarashi
@ 2015-09-07 9:00 ` Chen, Yu C
2015-09-07 21:46 ` Rafael J. Wysocki
2015-09-07 23:18 ` Seiichi Ikarashi
0 siblings, 2 replies; 6+ messages in thread
From: Chen, Yu C @ 2015-09-07 9:00 UTC (permalink / raw)
To: Seiichi Ikarashi, kristen, Wysocki, Rafael J; +Cc: linux-pm, Zhang, Rui
Hi, Seiichi
> -----Original Message-----
> From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> owner@vger.kernel.org] On Behalf Of Seiichi Ikarashi
> Sent: Friday, September 04, 2015 6:59 PM
> To: kristen@linux.intel.com; Wysocki, Rafael J
> Cc: linux-pm@vger.kernel.org
> Subject: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
>
> Add some value check to prevent a reversal, max_perf_pct < min_perf_pct.
>
> Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
>
I guess a similar patch has been sent at:
https://patchwork.kernel.org/patch/6995461/
Best Regards,
Yu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
2015-09-07 9:00 ` Chen, Yu C
@ 2015-09-07 21:46 ` Rafael J. Wysocki
2015-09-07 23:18 ` Seiichi Ikarashi
1 sibling, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2015-09-07 21:46 UTC (permalink / raw)
To: Chen, Yu C
Cc: Seiichi Ikarashi, kristen, Wysocki, Rafael J, linux-pm, Zhang, Rui
On Monday, September 07, 2015 09:00:39 AM Chen, Yu C wrote:
> Hi, Seiichi
>
> > -----Original Message-----
> > From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> > owner@vger.kernel.org] On Behalf Of Seiichi Ikarashi
> > Sent: Friday, September 04, 2015 6:59 PM
> > To: kristen@linux.intel.com; Wysocki, Rafael J
> > Cc: linux-pm@vger.kernel.org
> > Subject: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
> >
> > Add some value check to prevent a reversal, max_perf_pct < min_perf_pct.
> >
> > Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
> >
> I guess a similar patch has been sent at:
> https://patchwork.kernel.org/patch/6995461/
I seem to have overlooked this one, most likely because it was set as an
RFC.
I'll find it and respond to it now.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
2015-09-07 9:00 ` Chen, Yu C
2015-09-07 21:46 ` Rafael J. Wysocki
@ 2015-09-07 23:18 ` Seiichi Ikarashi
2015-09-08 7:27 ` Chen, Yu C
1 sibling, 1 reply; 6+ messages in thread
From: Seiichi Ikarashi @ 2015-09-07 23:18 UTC (permalink / raw)
To: Chen, Yu C; +Cc: kristen, Wysocki, Rafael J, linux-pm, Zhang, Rui
Hi, Yu
On 2015-09-07 18:00, Chen, Yu C wrote:
> Hi, Seiichi
>
>> -----Original Message-----
>> From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
>> owner@vger.kernel.org] On Behalf Of Seiichi Ikarashi
>> Sent: Friday, September 04, 2015 6:59 PM
>> To: kristen@linux.intel.com; Wysocki, Rafael J
>> Cc: linux-pm@vger.kernel.org
>> Subject: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
>>
>> Add some value check to prevent a reversal, max_perf_pct < min_perf_pct.
>>
>> Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
>>
> I guess a similar patch has been sent at:
> https://patchwork.kernel.org/patch/6995461/
Yes, your patch looks better than mine from the point of view
of covering intel_pstate_set_policy().
Still I have a question.
Does your patch allow the following condition?
limits.max_policy_pct > limits.min_perf_pct > limits.max_perf_pct > limits.min_policy_pct
Regards,
Ikarashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
2015-09-07 23:18 ` Seiichi Ikarashi
@ 2015-09-08 7:27 ` Chen, Yu C
2015-09-09 4:27 ` Seiichi Ikarashi
0 siblings, 1 reply; 6+ messages in thread
From: Chen, Yu C @ 2015-09-08 7:27 UTC (permalink / raw)
To: Seiichi Ikarashi; +Cc: kristen, Wysocki, Rafael J, linux-pm, Zhang, Rui
Hi, Seiichi
> -----Original Message-----
> From: Seiichi Ikarashi [mailto:s.ikarashi@jp.fujitsu.com]
> Sent: Tuesday, September 08, 2015 7:19 AM
> To: Chen, Yu C
> Cc: kristen@linux.intel.com; Wysocki, Rafael J; linux-pm@vger.kernel.org;
> Zhang, Rui
> Subject: Re: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
>
> Hi, Yu
>
> On 2015-09-07 18:00, Chen, Yu C wrote:
> > Hi, Seiichi
> >
> >> -----Original Message-----
> >> From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> >> owner@vger.kernel.org] On Behalf Of Seiichi Ikarashi
> >> Sent: Friday, September 04, 2015 6:59 PM
> >> To: kristen@linux.intel.com; Wysocki, Rafael J
> >> Cc: linux-pm@vger.kernel.org
> >> Subject: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
> >>
> >> Add some value check to prevent a reversal, max_perf_pct <
> min_perf_pct.
> >>
> >> Signed-off-by: Seiichi Ikarashi <s.ikarashi@jp.fujitsu.com>
> >>
> > I guess a similar patch has been sent at:
> > https://patchwork.kernel.org/patch/6995461/
>
> Yes, your patch looks better than mine from the point of view of covering
> intel_pstate_set_policy().
>
> Still I have a question.
> Does your patch allow the following condition?
>
> limits.max_policy_pct > limits.min_perf_pct > limits.max_perf_pct >
> limits.min_policy_pct
>
Thanks! Seems my previous patch does not guarantee
max_perf_pct >= min_perf_pct, I think following logic would be better:
Step0: normalize the user input to [min_policy, max_policy]
Step1: make sure max_perf_pct>= min_perf_pct
BTW,why I add step0 here is because we should not rely on user input, and
different policy might have different (min,max), for example,
max_policy_pct=40,min_policy_pct=30, and user input of
echo 50 > min_sysfs_pct would make the final min_perf_pct to
50, it's not in legal policy scope, so...
Best Regards,
Yu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct
2015-09-08 7:27 ` Chen, Yu C
@ 2015-09-09 4:27 ` Seiichi Ikarashi
0 siblings, 0 replies; 6+ messages in thread
From: Seiichi Ikarashi @ 2015-09-09 4:27 UTC (permalink / raw)
To: Chen, Yu C; +Cc: kristen, Wysocki, Rafael J, linux-pm, Zhang, Rui
Hi, Yu
On 2015-09-08 16:27, Chen, Yu C wrote:
> Hi, Seiichi
>
>>> I guess a similar patch has been sent at:
>>> https://patchwork.kernel.org/patch/6995461/
>>
>> Yes, your patch looks better than mine from the point of view of covering
>> intel_pstate_set_policy().
>>
>> Still I have a question.
>> Does your patch allow the following condition?
>>
>> limits.max_policy_pct > limits.min_perf_pct > limits.max_perf_pct >
>> limits.min_policy_pct
>>
>
> Thanks! Seems my previous patch does not guarantee
> max_perf_pct >= min_perf_pct, I think following logic would be better:
> Step0: normalize the user input to [min_policy, max_policy]
> Step1: make sure max_perf_pct>= min_perf_pct
>
> BTW,why I add step0 here is because we should not rely on user input, and
> different policy might have different (min,max), for example,
> max_policy_pct=40,min_policy_pct=30, and user input of
> echo 50 > min_sysfs_pct would make the final min_perf_pct to
> 50, it's not in legal policy scope, so...
Those two steps will make sense.
I will review your upcoming v2 patch.
Regards,
Seiichi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-09 4:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 10:58 [PATCH] intel_pstate: prevent max_perf_pct < min_perf_pct Seiichi Ikarashi
2015-09-07 9:00 ` Chen, Yu C
2015-09-07 21:46 ` Rafael J. Wysocki
2015-09-07 23:18 ` Seiichi Ikarashi
2015-09-08 7:27 ` Chen, Yu C
2015-09-09 4:27 ` Seiichi Ikarashi
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.