diff mbox series

[RFC,v2,1/3] cpufreq: handle the return value of '.set_boost()' properly

Message ID 1589785808-12138-2-git-send-email-wangxiongfeng2@huawei.com (mailing list archive)
State Superseded, archived
Headers show
Series add SW BOOST support for CPPC | expand

Commit Message

Xiongfeng Wang May 18, 2020, 7:10 a.m. UTC
'freq_qos_update_request()' called by 'cpufreq_boost_set_sw()' reutrns 1
when the effective constraint value of frequency QoS has changed. It's
not an error code. So handle the return value 1 of '.set_boost()' in
'cpufreq_boost_trigger_state()' properly.

Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/cpufreq/cpufreq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Viresh Kumar May 18, 2020, 7:46 a.m. UTC | #1
On 18-05-20, 15:10, Xiongfeng Wang wrote:
> 'freq_qos_update_request()' called by 'cpufreq_boost_set_sw()' reutrns 1
> when the effective constraint value of frequency QoS has changed. It's
> not an error code. So handle the return value 1 of '.set_boost()' in
> 'cpufreq_boost_trigger_state()' properly.
> 
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> ---
>  drivers/cpufreq/cpufreq.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 4adac3a..bb6746e 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2540,7 +2540,10 @@ int cpufreq_boost_trigger_state(int state)
>  	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>  
>  	ret = cpufreq_driver->set_boost(state);
> -	if (ret) {
> +	if (ret == 1) {
> +		pr_debug("The effective constraint value of frequency QoS has changed.\n");
> +		return 0;
> +	} else if (ret) {

Rafael, IMO it is better to pick patch from Sergey for this as this is
implementation detail.

>  		write_lock_irqsave(&cpufreq_driver_lock, flags);
>  		cpufreq_driver->boost_enabled = !state;
>  		write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> -- 
> 1.7.12.4
Viresh Kumar May 18, 2020, 11:43 a.m. UTC | #2
On 18-05-20, 13:16, Viresh Kumar wrote:
> On 18-05-20, 15:10, Xiongfeng Wang wrote:
> > 'freq_qos_update_request()' called by 'cpufreq_boost_set_sw()' reutrns 1
> > when the effective constraint value of frequency QoS has changed. It's
> > not an error code. So handle the return value 1 of '.set_boost()' in
> > 'cpufreq_boost_trigger_state()' properly.
> > 
> > Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> > ---
> >  drivers/cpufreq/cpufreq.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 4adac3a..bb6746e 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -2540,7 +2540,10 @@ int cpufreq_boost_trigger_state(int state)
> >  	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> >  
> >  	ret = cpufreq_driver->set_boost(state);
> > -	if (ret) {
> > +	if (ret == 1) {
> > +		pr_debug("The effective constraint value of frequency QoS has changed.\n");
> > +		return 0;
> > +	} else if (ret) {
> 
> Rafael, IMO it is better to pick patch from Sergey for this as this is
> implementation detail.
> 
> >  		write_lock_irqsave(&cpufreq_driver_lock, flags);
> >  		cpufreq_driver->boost_enabled = !state;
> >  		write_unlock_irqrestore(&cpufreq_driver_lock, flags);

This is already fixed in the PM tree with a different patch Xiongfeng.
Xiongfeng Wang May 19, 2020, 1:12 a.m. UTC | #3
Hi Viresh,

On 2020/5/18 19:43, Viresh Kumar wrote:
> On 18-05-20, 13:16, Viresh Kumar wrote:
>> On 18-05-20, 15:10, Xiongfeng Wang wrote:
>>> 'freq_qos_update_request()' called by 'cpufreq_boost_set_sw()' reutrns 1
>>> when the effective constraint value of frequency QoS has changed. It's
>>> not an error code. So handle the return value 1 of '.set_boost()' in
>>> 'cpufreq_boost_trigger_state()' properly.
>>>
>>> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
>>> ---
>>>  drivers/cpufreq/cpufreq.c | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>>> index 4adac3a..bb6746e 100644
>>> --- a/drivers/cpufreq/cpufreq.c
>>> +++ b/drivers/cpufreq/cpufreq.c
>>> @@ -2540,7 +2540,10 @@ int cpufreq_boost_trigger_state(int state)
>>>  	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>>>  
>>>  	ret = cpufreq_driver->set_boost(state);
>>> -	if (ret) {
>>> +	if (ret == 1) {
>>> +		pr_debug("The effective constraint value of frequency QoS has changed.\n");
>>> +		return 0;
>>> +	} else if (ret) {
>>
>> Rafael, IMO it is better to pick patch from Sergey for this as this is
>> implementation detail.
>>
>>>  		write_lock_irqsave(&cpufreq_driver_lock, flags);
>>>  		cpufreq_driver->boost_enabled = !state;
>>>  		write_unlock_irqrestore(&cpufreq_driver_lock, flags);
> 
> This is already fixed in the PM tree with a different patch Xiongfeng.

Thanks for telling me. I will drop it in the next version.

Thanks,
Xiongfeng

>
diff mbox series

Patch

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 4adac3a..bb6746e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2540,7 +2540,10 @@  int cpufreq_boost_trigger_state(int state)
 	write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
 	ret = cpufreq_driver->set_boost(state);
-	if (ret) {
+	if (ret == 1) {
+		pr_debug("The effective constraint value of frequency QoS has changed.\n");
+		return 0;
+	} else if (ret) {
 		write_lock_irqsave(&cpufreq_driver_lock, flags);
 		cpufreq_driver->boost_enabled = !state;
 		write_unlock_irqrestore(&cpufreq_driver_lock, flags);