mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: zhuguangqing83@gmail.com, amit.kachhap@gmail.com,
	viresh.kumar@linaro.org, javi.merino@kernel.org,
	rui.zhang@intel.com, amitk@kernel.org, zhuguangqing@xiaomi.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] thermal/drivers/cpuidle_cooling: Change the set_cur_state function
Date: Thu, 17 Sep 2020 09:05:30 +0200	[thread overview]
Message-ID: <ff6e6aaa-3707-b320-0afe-d34118be4a2b@linaro.org> (raw)
In-Reply-To: <20200917060031.6566-1-zhuguangqing83@gmail.com>

On 17/09/2020 08:00, zhuguangqing83@gmail.com wrote:
> From: zhuguangqing <zhuguangqing@xiaomi.com>
> 
> In the function cpuidle_cooling_set_cur_state(), if current_state is
> not equal to state and both current_state and state are greater than
> 0(scene 4 as follows), then maybe it should stop->start or restart
> idle_inject.

Sorry, I don't get it.

It is an update of the state, why do we need to restart the idle
injection ? The state change will be automatically take into account by
the idle injection code at the new injection cycle.

> The scenes changed is as follows,
> 
> scene    current_state    state    action
>  1              0          >0       start
>  2              0          0        do nothing
>  3              >0         0        stop
>  4        >0 && !=state    >0       stop->start or restart
>  5        >0 && ==state    >0       do nothing
> 
> Signed-off-by: zhuguangqing <zhuguangqing@xiaomi.com>
> ---
>  drivers/thermal/cpuidle_cooling.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/thermal/cpuidle_cooling.c b/drivers/thermal/cpuidle_cooling.c
> index 78e3e8238116..868919ad3dda 100644
> --- a/drivers/thermal/cpuidle_cooling.c
> +++ b/drivers/thermal/cpuidle_cooling.c
> @@ -113,7 +113,7 @@ static int cpuidle_cooling_get_cur_state(struct thermal_cooling_device *cdev,
>  /**
>   * cpuidle_cooling_set_cur_state - Set the current cooling state
>   * @cdev: the thermal cooling device
> - * @state: the target state
> + * @state: the target state, max value is 100
>   *
>   * The function checks first if we are initiating the mitigation which
>   * in turn wakes up all the idle injection tasks belonging to the idle
> @@ -130,6 +130,9 @@ static int cpuidle_cooling_set_cur_state(struct thermal_cooling_device *cdev,
>  	unsigned long current_state = idle_cdev->state;
>  	unsigned int runtime_us, idle_duration_us;
>  
> +	if (state > 100 || current_state == state)
> +		return 0;
> +
>  	idle_cdev->state = state;
>  
>  	idle_inject_get_duration(ii_dev, &runtime_us, &idle_duration_us);
> @@ -140,8 +143,11 @@ static int cpuidle_cooling_set_cur_state(struct thermal_cooling_device *cdev,
>  
>  	if (current_state == 0 && state > 0) {
>  		idle_inject_start(ii_dev);
> -	} else if (current_state > 0 && !state)  {
> +	} else if (current_state > 0 && !state) {
>  		idle_inject_stop(ii_dev);
> +	} else {
> +		idle_inject_stop(ii_dev);
> +		idle_inject_start(ii_dev);
>  	}
>  
>  	return 0;
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2020-09-17  7:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  6:00 zhuguangqing83
2020-09-17  7:05 ` Daniel Lezcano [this message]
2020-09-17 11:15 zhuguangqing83
2020-09-17 12:33 ` Daniel Lezcano
2020-09-17 13:22   ` Daniel Lezcano
2020-09-17 12:52 zhuguangqing83

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=ff6e6aaa-3707-b320-0afe-d34118be4a2b@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amit.kachhap@gmail.com \
    --cc=amitk@kernel.org \
    --cc=javi.merino@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=viresh.kumar@linaro.org \
    --cc=zhuguangqing83@gmail.com \
    --cc=zhuguangqing@xiaomi.com \
    /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

all inboxes | Powered by JetHome®