intel_pstate: prevent max_perf_pct < min_perf_pct
Subsystems (2)
PATCH 1/1 intel_pstate: prevent max_perf_pct < min_perf_pct
Add some value check to prevent a reversal, max_perf_pct < min_perf_pct.
--- drivers/cpufreq/intel_pstate.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/cpufreq/intel_pstate.c +2 -0
@@ -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)
Hi, Seiichi
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Seiichi Ikarashi
Sent: Friday, September 04, 2015 6:59 PM
To: [email protected]; Wysocki, Rafael J
Cc: [email protected]
Subject: [PATCH]intel_pstate: preventmax_perf_pct<min_perf_pct
Quoted 4 lines
Add some value check to prevent a reversal,
max_perf_pct<min_perf_pct.Signed-off-by Seiichi Ikarashi <[email protected]>
I guess a similar patch has been sent at:
https://patchwork.kernel.org/patch/6995461/
Best Regards,
Yu
Quoted 10 lines · Yu C
Hi, Seiichi
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Seiichi Ikarashi
Sent: Friday, September 04, 2015 6:59 PM
To: [email protected]; Wysocki, Rafael J
Cc: [email protected]
Subject: [PATCH]intel_pstate: preventmax_perf_pct<min_perf_pct
Quoted 6 lines
Quoted 4 lines
Add some value check to prevent a reversal,
max_perf_pct<min_perf_pct.Signed-off-by Seiichi Ikarashi <[email protected]>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
Hi, Yu
Quoted 10 lines · Yu C
Hi, Seiichi
Quoted 8 lines
-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Seiichi Ikarashi
Sent: Friday, September 04, 2015 6:59 PM
To: [email protected]; Wysocki, Rafael J
Cc: [email protected]
Subject: [PATCH]intel_pstate: preventmax_perf_pct<min_perf_pct
Quoted 6 lines
Quoted 4 lines
Add some value check to prevent a reversal,
max_perf_pct<min_perf_pct.Signed-off-by Seiichi Ikarashi <[email protected]>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
Hi, Seiichi
Quoted 29 lines
-----Original Message-----
From: Seiichi Ikarashi [mailto:[email protected]]
Sent: Tuesday, September 08, 2015 7:19 AM
To: Chen, Yu C
Cc: [email protected]; Wysocki, Rafael J; [email protected]; Zhang, Rui
Subject: Re: [PATCH]intel_pstate: preventmax_perf_pct<min_perf_pctHi, Yu
Quoted 11 lines · Yu C
Hi, Seiichi
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:linux-pm- [email protected]] On Behalf Of Seiichi Ikarashi
Sent: Friday, September 04, 2015 6:59 PM
To: [email protected]; Wysocki, Rafael J
Cc: [email protected]
Subject: [PATCH]intel_pstate: preventmax_perf_pct<min_perf_pctAdd some value check to prevent a reversal,
max_perf_pct<
min_perf_pct.Quoted 5 lines
Quoted 3 lines
Signed-off-by Seiichi Ikarashi <[email protected]>I guess a similar patch has been sent at:
https://patchwork.kernel.org/patch/6995461/
Quoted 9 lines
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
Hi, Yu
Quoted 20 lines · Yu C
Hi, Seiichi
Quoted 12 lines
Quoted 2 lines
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_pctThanks! 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
Quoted 5 lines
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_pctwould make the finalmin_perf_pctto 50, it's not in legal policy scope, so...
Those two steps will make sense.
I will review your upcoming v2 patch.
Regards,
Seiichi