linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V5 3/3] powercap/drivers/idle_inject: Specify the idle state to inject
Date: Mon, 28 Oct 2019 23:26:12 +0100	[thread overview]
Message-ID: <CAPDyKFodr8+7W8FP_P4Ha6h3dgq-K93Hwn-_uAeY-Amwq1Q=qw@mail.gmail.com> (raw)
In-Reply-To: <20191028143419.16236-3-daniel.lezcano@linaro.org>

On Mon, 28 Oct 2019 at 15:34, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> Currently the idle injection framework only allows to inject the
> deepest idle state available on the system.
>
> Give the opportunity to specify which idle state we want to inject by
> adding a new function helper to set the state and use it when calling
> play_idle().
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe


> ---
>  drivers/powercap/idle_inject.c | 14 +++++++++++++-
>  include/linux/idle_inject.h    |  3 +++
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/powercap/idle_inject.c b/drivers/powercap/idle_inject.c
> index 233c878cbf46..5e1efc71ed1c 100644
> --- a/drivers/powercap/idle_inject.c
> +++ b/drivers/powercap/idle_inject.c
> @@ -66,6 +66,7 @@ struct idle_inject_thread {
>   */
>  struct idle_inject_device {
>         struct hrtimer timer;
> +       int state;
>         unsigned int idle_duration_us;
>         unsigned int run_duration_us;
>         unsigned long int cpumask[0];
> @@ -140,7 +141,7 @@ static void idle_inject_fn(unsigned int cpu)
>         iit->should_run = 0;
>
>         play_idle(READ_ONCE(ii_dev->idle_duration_us),
> -                 cpuidle_find_deepest_state());
> +                 READ_ONCE(ii_dev->state));
>  }
>
>  /**
> @@ -171,6 +172,16 @@ void idle_inject_get_duration(struct idle_inject_device *ii_dev,
>         *idle_duration_us = READ_ONCE(ii_dev->idle_duration_us);
>  }
>
> +/**
> + * idle_inject_set_state - set the idle state to inject
> + * @state: an integer for the idle state to inject
> + */
> +void idle_inject_set_state(struct idle_inject_device *ii_dev, int state)
> +{
> +       if (state >= CPUIDLE_STATE_NOUSE && state < CPUIDLE_STATE_MAX)
> +               WRITE_ONCE(ii_dev->state, state);
> +}
> +
>  /**
>   * idle_inject_start - start idle injections
>   * @ii_dev: idle injection control device structure
> @@ -299,6 +310,7 @@ struct idle_inject_device *idle_inject_register(struct cpumask *cpumask)
>         cpumask_copy(to_cpumask(ii_dev->cpumask), cpumask);
>         hrtimer_init(&ii_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>         ii_dev->timer.function = idle_inject_timer_fn;
> +       ii_dev->state = 0;
>
>         for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) {
>
> diff --git a/include/linux/idle_inject.h b/include/linux/idle_inject.h
> index a445cd1a36c5..e2b26b9ccd34 100644
> --- a/include/linux/idle_inject.h
> +++ b/include/linux/idle_inject.h
> @@ -26,4 +26,7 @@ void idle_inject_set_duration(struct idle_inject_device *ii_dev,
>  void idle_inject_get_duration(struct idle_inject_device *ii_dev,
>                                  unsigned int *run_duration_us,
>                                  unsigned int *idle_duration_us);
> +
> +void idle_inject_set_state(struct idle_inject_device *ii_dev, int state);
> +
>  #endif /* __IDLE_INJECT_H__ */
> --
> 2.17.1
>

  reply	other threads:[~2019-10-28 22:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 14:34 [PATCH V5 1/3] cpuidle: play_idle: Make play_idle more flexible Daniel Lezcano
2019-10-28 14:34 ` [PATCH V5 2/3] cpuidle: play_idle: Specify play_idle with an idle state Daniel Lezcano
2019-10-28 22:26   ` Ulf Hansson
2019-10-28 14:34 ` [PATCH V5 3/3] powercap/drivers/idle_inject: Specify the idle state to inject Daniel Lezcano
2019-10-28 22:26   ` Ulf Hansson [this message]
2019-10-28 22:26 ` [PATCH V5 1/3] cpuidle: play_idle: Make play_idle more flexible Ulf Hansson
2019-10-29  8:32   ` Daniel Lezcano

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='CAPDyKFodr8+7W8FP_P4Ha6h3dgq-K93Hwn-_uAeY-Amwq1Q=qw@mail.gmail.com' \
    --to=ulf.hansson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).