From: Kevin Hilman <khilman@baylibre.com>
To: Lina Iyer <lina.iyer@linaro.org>
Cc: ulf.hansson@linaro.org, rjw@rjwysocki.net,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
geert@linux-m68k.org, k.kozlowski@samsung.com,
andy.gross@linaro.org, sboyd@codeaurora.org,
linux-arm-msm@vger.kernel.org, lorenzo.pieralisi@arm.com,
ahaslam@baylibre.com, mtitinger@baylibre.com,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 08/14] timer: Export next wake up of a CPU
Date: Tue, 26 Jul 2016 11:26:48 -0700 [thread overview]
Message-ID: <m24m7cw907.fsf@baylibre.com> (raw)
In-Reply-To: <1466624209-27432-9-git-send-email-lina.iyer@linaro.org> (Lina Iyer's message of "Wed, 22 Jun 2016 13:36:43 -0600")
Lina Iyer <lina.iyer@linaro.org> writes:
> Knowing the sleep length of the CPU is useful for the power state
> determination on idle. However, when the common sleep time between
> multiple CPUs is needed, the sleep length of a CPU is not useful.
You need more about "why" it's not useful. e.g. CPU sleep length is
relative to when that CPU entered idle, whereas when trying to determine
cluster sleep time, absolute times are needed, like dev->next_event.
> By reading the next wake up event of a CPU, governors can determine the
> first CPU to wake up (due to timer) amongst a cluster of CPUs and the
> sleep time available between the last CPU to idle and the first CPU to
> resume. This information is useful to determine if the caches and other
> common hardware blocks can also be put in idle during this common period
> of inactivity.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
Otherwise, looks OK to me.
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
> ---
> include/linux/tick.h | 10 ++++++++++
> kernel/time/tick-sched.c | 13 +++++++++++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/include/linux/tick.h b/include/linux/tick.h
> index 62be0786..9535141 100644
> --- a/include/linux/tick.h
> +++ b/include/linux/tick.h
> @@ -117,6 +117,7 @@ extern void tick_nohz_idle_enter(void);
> extern void tick_nohz_idle_exit(void);
> extern void tick_nohz_irq_exit(void);
> extern ktime_t tick_nohz_get_sleep_length(void);
> +extern ktime_t tick_nohz_get_next_wakeup(int cpu);
> extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
> extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
> #else /* !CONFIG_NO_HZ_COMMON */
> @@ -131,6 +132,15 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
>
> return len;
> }
> +
> +static inline ktime_t tick_nohz_get_next_wakeup(int cpu)
> +{
> + ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
> +
> + /* Next wake up is the tick period, assume it starts now */
> + return ktime_add(len, ktime_get());
> +}
> +
> static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
> static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
> #endif /* !CONFIG_NO_HZ_COMMON */
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 536ada8..addf3235 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -979,6 +979,19 @@ ktime_t tick_nohz_get_sleep_length(void)
> return ts->sleep_length;
> }
>
> +/**
> + * tick_nohz_get_next_wakeup - return the next wake up of the CPU
> + *
> + * Called with interrupts disabled on the cpu
> + */
> +ktime_t tick_nohz_get_next_wakeup(int cpu)
> +{
> + struct clock_event_device *dev =
> + per_cpu(tick_cpu_device.evtdev, cpu);
> +
> + return dev->next_event;
> +}
> +
> static void tick_nohz_account_idle_ticks(struct tick_sched *ts)
> {
> #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
WARNING: multiple messages have this Message-ID (diff)
From: khilman@baylibre.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/14] timer: Export next wake up of a CPU
Date: Tue, 26 Jul 2016 11:26:48 -0700 [thread overview]
Message-ID: <m24m7cw907.fsf@baylibre.com> (raw)
In-Reply-To: <1466624209-27432-9-git-send-email-lina.iyer@linaro.org> (Lina Iyer's message of "Wed, 22 Jun 2016 13:36:43 -0600")
Lina Iyer <lina.iyer@linaro.org> writes:
> Knowing the sleep length of the CPU is useful for the power state
> determination on idle. However, when the common sleep time between
> multiple CPUs is needed, the sleep length of a CPU is not useful.
You need more about "why" it's not useful. e.g. CPU sleep length is
relative to when that CPU entered idle, whereas when trying to determine
cluster sleep time, absolute times are needed, like dev->next_event.
> By reading the next wake up event of a CPU, governors can determine the
> first CPU to wake up (due to timer) amongst a cluster of CPUs and the
> sleep time available between the last CPU to idle and the first CPU to
> resume. This information is useful to determine if the caches and other
> common hardware blocks can also be put in idle during this common period
> of inactivity.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
Otherwise, looks OK to me.
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
> ---
> include/linux/tick.h | 10 ++++++++++
> kernel/time/tick-sched.c | 13 +++++++++++++
> 2 files changed, 23 insertions(+)
>
> diff --git a/include/linux/tick.h b/include/linux/tick.h
> index 62be0786..9535141 100644
> --- a/include/linux/tick.h
> +++ b/include/linux/tick.h
> @@ -117,6 +117,7 @@ extern void tick_nohz_idle_enter(void);
> extern void tick_nohz_idle_exit(void);
> extern void tick_nohz_irq_exit(void);
> extern ktime_t tick_nohz_get_sleep_length(void);
> +extern ktime_t tick_nohz_get_next_wakeup(int cpu);
> extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
> extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
> #else /* !CONFIG_NO_HZ_COMMON */
> @@ -131,6 +132,15 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
>
> return len;
> }
> +
> +static inline ktime_t tick_nohz_get_next_wakeup(int cpu)
> +{
> + ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
> +
> + /* Next wake up is the tick period, assume it starts now */
> + return ktime_add(len, ktime_get());
> +}
> +
> static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
> static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
> #endif /* !CONFIG_NO_HZ_COMMON */
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 536ada8..addf3235 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -979,6 +979,19 @@ ktime_t tick_nohz_get_sleep_length(void)
> return ts->sleep_length;
> }
>
> +/**
> + * tick_nohz_get_next_wakeup - return the next wake up of the CPU
> + *
> + * Called with interrupts disabled on the cpu
> + */
> +ktime_t tick_nohz_get_next_wakeup(int cpu)
> +{
> + struct clock_event_device *dev =
> + per_cpu(tick_cpu_device.evtdev, cpu);
> +
> + return dev->next_event;
> +}
> +
> static void tick_nohz_account_idle_ticks(struct tick_sched *ts)
> {
> #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
next prev parent reply other threads:[~2016-07-26 18:26 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 19:36 [PATCH 00/14] PM: SoC idle support using PM domains Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 01/14] PM / Domains: Allow domain power states to be read from DT Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-23 17:38 ` Mark Rutland
2016-06-23 17:38 ` Mark Rutland
[not found] ` <1466624209-27432-1-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-22 19:36 ` [PATCH 02/14] dt/bindings: update binding for PM domain idle states Lina Iyer
2016-06-22 19:36 ` Lina Iyer
[not found] ` <1466624209-27432-3-git-send-email-lina.iyer-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-23 17:35 ` Mark Rutland
2016-06-23 17:35 ` Mark Rutland
2016-06-23 18:04 ` Lina Iyer
2016-06-23 18:04 ` Lina Iyer
[not found] ` <20160623180451.GD1115-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-06-23 18:19 ` Mark Rutland
2016-06-23 18:19 ` Mark Rutland
2016-06-23 18:39 ` Lina Iyer
2016-06-23 18:39 ` Lina Iyer
2016-07-27 11:11 ` [draft] " Brendan Jackman
2016-06-22 19:36 ` [PATCH 03/14] PM / Domains: Abstract genpd locking Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 04/14] PM / Domains: Support IRQ safe PM domains Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 05/14] PM / doc: update device documentation for devices in " Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-07-25 22:50 ` Kevin Hilman
2016-07-25 22:50 ` Kevin Hilman
2016-07-25 23:21 ` Lina Iyer
2016-07-25 23:21 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 06/14] PM / cpu_domains: Setup PM domains for CPUs/clusters Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 07/14] ARM: cpuidle: Add runtime PM support for CPUs Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 08/14] timer: Export next wake up of a CPU Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-07-26 18:26 ` Kevin Hilman [this message]
2016-07-26 18:26 ` Kevin Hilman
2016-07-27 9:14 ` Thomas Gleixner
2016-07-27 9:14 ` Thomas Gleixner
2016-07-27 15:04 ` Lina Iyer
2016-07-27 15:04 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 09/14] PM / cpu_domains: Add PM Domain governor for CPUs Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 10/14] doc / cpu_domains: Describe CPU PM domains setup and governor Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 11/14] drivers: firmware: psci: Allow OS Initiated suspend mode Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-24 4:25 ` Vikas Sajjan
2016-06-24 4:25 ` Vikas Sajjan
2016-06-24 16:53 ` Lina Iyer
2016-06-24 16:53 ` Lina Iyer
2016-06-27 10:12 ` Mark Rutland
2016-06-27 10:12 ` Mark Rutland
2016-06-28 6:07 ` Vikas Sajjan
2016-06-28 6:07 ` Vikas Sajjan
2016-06-22 19:36 ` [PATCH 12/14] drivers: firmware: psci: Support cluster idle states for OS-Initiated Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 13/14] ARM64: dts: Add PSCI cpuidle support for MSM8916 Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-06-22 19:36 ` [PATCH 14/14] ARM64: dts: Define CPU power domain " Lina Iyer
2016-06-22 19:36 ` Lina Iyer
2016-07-26 22:08 ` [PATCH 00/14] PM: SoC idle support using PM domains Kevin Hilman
2016-07-26 22:08 ` Kevin Hilman
2016-07-27 15:06 ` Lina Iyer
2016-07-27 15:06 ` Lina Iyer
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=m24m7cw907.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=ahaslam@baylibre.com \
--cc=andy.gross@linaro.org \
--cc=geert@linux-m68k.org \
--cc=k.kozlowski@samsung.com \
--cc=lina.iyer@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mtitinger@baylibre.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@codeaurora.org \
--cc=tglx@linutronix.de \
--cc=ulf.hansson@linaro.org \
/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 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.