From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH 10/10] nohz: Warn on illegal timekeeper switch in nohz full
Date: Mon, 21 Jul 2014 10:51:50 -0700 [thread overview]
Message-ID: <20140721175150.GE8690@linux.vnet.ibm.com> (raw)
In-Reply-To: <1405730661-9355-11-git-send-email-fweisbec@gmail.com>
On Sat, Jul 19, 2014 at 02:44:21AM +0200, Frederic Weisbecker wrote:
> In full dynticks idle mode, the timekeeper should never be set to another
> CPU than 0.
>
> Lets enforce that through a dedicated mutator.
>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> kernel/time/tick-common.c | 9 ++++-----
> kernel/time/tick-internal.h | 7 +++++++
> kernel/time/tick-sched.c | 7 +++----
> 3 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
> index cb57bce..72ccaf2 100644
> --- a/kernel/time/tick-common.c
> +++ b/kernel/time/tick-common.c
> @@ -180,9 +180,9 @@ static void tick_setup_device(struct tick_device *td,
> */
> if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
> if (tick_nohz_full_enabled())
> - tick_do_timer_cpu = TICK_DO_TIMER_DEFAULT;
> + tick_do_timer_cpu_set(TICK_DO_TIMER_DEFAULT);
> else
> - tick_do_timer_cpu = cpu;
> + tick_do_timer_cpu_set(cpu);
> tick_next_period = ktime_get();
> tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
> }
> @@ -341,9 +341,8 @@ void tick_handover_do_timer(int *cpup)
> {
> if (*cpup == tick_do_timer_cpu) {
> int cpu = cpumask_first(cpu_online_mask);
> -
> - tick_do_timer_cpu = (cpu < nr_cpu_ids) ? cpu :
> - TICK_DO_TIMER_NONE;
> + tick_do_timer_cpu_set((cpu < nr_cpu_ids) ? cpu :
> + TICK_DO_TIMER_NONE);
> }
> }
>
> diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
> index 6b592a8..eadfd89 100644
> --- a/kernel/time/tick-internal.h
> +++ b/kernel/time/tick-internal.h
> @@ -23,6 +23,13 @@ extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
> extern void tick_handle_periodic(struct clock_event_device *dev);
> extern void tick_check_new_device(struct clock_event_device *dev);
> extern void tick_handover_do_timer(int *cpup);
> +
> +static inline void tick_do_timer_cpu_set(int cpu)
> +{
> + WARN_ON_ONCE(tick_nohz_full_enabled() && cpu != TICK_DO_TIMER_DEFAULT);
> + tick_do_timer_cpu = cpu;
> +}
> +
> extern void tick_shutdown(unsigned int *cpup);
> extern void tick_suspend(void);
> extern void tick_resume(void);
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index 845aaff..3b5102a 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -123,7 +123,7 @@ static void tick_sched_do_timer(ktime_t now)
> */
> if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE)
> && !tick_nohz_full_cpu(cpu))
> - tick_do_timer_cpu = cpu;
> + tick_do_timer_cpu_set(cpu);
> #endif
>
> /* Check, if the jiffies need an update */
> @@ -550,7 +550,7 @@ static u64 timekeeping_deferment(struct tick_sched *ts, int cpu)
> ts->do_timer_last = 1;
> /* In full dynticks mode, CPU 0 always keeps the duty */
> if (!tick_nohz_full_enabled())
> - tick_do_timer_cpu = TICK_DO_TIMER_NONE;
> + tick_do_timer_cpu_set(TICK_DO_TIMER_NONE);
> } else if (ts->do_timer_last) {
> if (tick_do_timer_cpu == TICK_DO_TIMER_NONE)
> time_delta = timekeeping_max_deferment();
> @@ -600,7 +600,6 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
> /* Schedule the tick, if we are at least one jiffie off */
> if ((long)delta_jiffies >= 1) {
> u64 time_delta = timekeeping_deferment(ts, cpu);
> -
> #ifdef CONFIG_NO_HZ_FULL
> if (!ts->inidle) {
> time_delta = min(time_delta,
> @@ -717,7 +716,7 @@ static bool can_stop_idle_tick(int cpu, struct tick_sched *ts)
> */
> if (unlikely(!cpu_online(cpu))) {
> if (cpu == tick_do_timer_cpu)
> - tick_do_timer_cpu = TICK_DO_TIMER_NONE;
> + tick_do_timer_cpu_set(TICK_DO_TIMER_NONE);
> return false;
> }
>
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2014-07-21 17:51 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-19 0:44 [RFC PATCH 00/10] nohz: Support sysidle (and some more cleanups) Frederic Weisbecker
2014-07-19 0:44 ` [PATCH 01/10] irq_work: Introduce void irq work Frederic Weisbecker
2014-07-21 18:16 ` Paul E. McKenney
2014-07-19 0:44 ` [PATCH 02/10] nohz: Kick full dynticks timer targets with an empty IPI Frederic Weisbecker
2014-07-19 7:19 ` Peter Zijlstra
2014-07-19 13:18 ` Frederic Weisbecker
2014-07-19 13:47 ` Peter Zijlstra
2014-07-19 13:54 ` Frederic Weisbecker
2014-07-19 0:44 ` [PATCH 03/10] rcu: Kick full dynticks CPU on extended grace period with a void IRQ Frederic Weisbecker
2014-07-21 18:16 ` Paul E. McKenney
2014-07-19 0:44 ` [PATCH 04/10] nohz: Appropriate timekeeper kick on sysidle break Frederic Weisbecker
2014-07-21 18:15 ` Paul E. McKenney
2014-07-19 0:44 ` [PATCH 05/10] smp: Fast path check on IPI list Frederic Weisbecker
2014-07-19 0:44 ` [PATCH 06/10] nohz: Define meaningful symbol for nohz full timekeeper Frederic Weisbecker
2014-07-21 18:11 ` Paul E. McKenney
2014-07-21 18:12 ` Paul E. McKenney
2014-07-25 21:27 ` Frederic Weisbecker
2014-07-19 0:44 ` [PATCH 07/10] nohz: Enforce timekeeping on CPU 0 Frederic Weisbecker
2014-07-19 17:31 ` Nicolas Pitre
2014-07-19 18:31 ` Peter Zijlstra
2014-07-19 18:46 ` Nicolas Pitre
2014-07-19 19:45 ` Peter Zijlstra
2014-07-20 1:07 ` Frederic Weisbecker
2014-07-19 0:44 ` [PATCH 08/10] nohz: Fetch timekeeping max deferment only for timekeeper Frederic Weisbecker
2014-07-19 0:44 ` [PATCH 09/10] nohz: Switch nohz full timekeeper to dynticks idle on top of sysidle detection Frederic Weisbecker
2014-07-21 17:50 ` Paul E. McKenney
2014-07-19 0:44 ` [PATCH 10/10] nohz: Warn on illegal timekeeper switch in nohz full Frederic Weisbecker
2014-07-21 17:51 ` Paul E. McKenney [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-07-28 17:37 [PATCH 00/10] nohz: Support sysidle (+ some more nohz kick cleanups) Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 10/10] nohz: Warn on illegal timekeeper switch in nohz full Frederic Weisbecker
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=20140721175150.GE8690@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox