From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Viresh Kumar <viresh.kumar@linaro.org>
Subject: Re: [PATCH 07/10] nohz: Enforce timekeeping on CPU 0
Date: Wed, 30 Jul 2014 15:23:36 +0200 [thread overview]
Message-ID: <20140730132333.GA18158@localhost.localdomain> (raw)
In-Reply-To: <20140729121237.GY3935@laptop>
On Tue, Jul 29, 2014 at 02:12:37PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 28, 2014 at 07:37:33PM +0200, Frederic Weisbecker wrote:
> > The timekeeper gets initialized to the value of the CPU where the
> > first clockevent device is setup. This works well because the timekeeper
> > can be any online CPU in most configs.
> >
> > Full dynticks has its own requirement though and needs the timekeeper
> > to always be 0. And this requirement seem to accomodate pretty well with
> > the above described boot timekeeper setting because the first clockevent
> > device happens to be initialized, most of the time, on the boot CPU
> > (which should be CPU 0).
>
> This isn't true in general, Voyager (which we dropped support for iirc)
> had a boot cpu != 0, and I think there's ARM platforms where the same
> can be true.
Ah I didn't know that. But I heard before that assuming CPU0 as the boot
CPU is a mistake.
>
> > However there is no mention of such a guarantee anywhere. This assumption
> > might well be defeated on some corner case now or in the future.
>
> Right..
>
> > So lets wipe out the FUD and force tick_do_timer_cpu to CPU 0 on boot
> > when full dynticks is used.
> >
> > This way we can even remove some corner case code that handled scenarios
> > where all clockevent devices were setup on full dynticks CPUs.
>
> > diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
> > index 0a0608e..cb57bce 100644
> > --- a/kernel/time/tick-common.c
> > +++ b/kernel/time/tick-common.c
> > @@ -179,10 +179,10 @@ static void tick_setup_device(struct tick_device *td,
> > * this cpu:
> > */
> > if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
> > - if (!tick_nohz_full_cpu(cpu))
> > - tick_do_timer_cpu = cpu;
> > + if (tick_nohz_full_enabled())
> > + tick_do_timer_cpu = TICK_DO_TIMER_DEFAULT;
> > else
> > - tick_do_timer_cpu = TICK_DO_TIMER_NONE;
> > + tick_do_timer_cpu = cpu;
> > tick_next_period = ktime_get();
> > tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
> > }
>
> So from what I can tell this code can get called before SMP setup, which
> would mean we could get here before CPU0 is online?
If CPU0 is a secondary CPU then yeah we have a problem.
Look, the most important for me is to determine the boot CPU and make sure
we don't need to offline it for suspend.
Looking at disable_nonboot_cpus(), it seems that the lowest number from the online set
is considered the boot CPU. But if CPU0 boots after the boot CPU, this assumption is defeated,
right?
Probably disable_nonboot_cpus() doesn't look for the real boot CPU but
rather it just tries to keep at least one CPU alive for stopping and resuming the
suspend process.
It looks like the only sane thing I can do is:
1) Pick up the boot CPU (the one that calls tick_nohz_init() for example) as the
default timekeeper.
2) Let it be offlined but then handover its timekeeping duty to any online CPU,
whether full dynticks or not (of course then the full dynticks timekeeper won't be
ever allowed to enter in full dynticks mode), we don't have the choice anyway.
But then we need a way to reset the sysidle state when we handover the timekeeping
duty.
Big headaches on the horizon!
Why haven't we kept CPU0 as the boot CPU for everyone? Things were just simple that way...
next prev parent reply other threads:[~2014-07-30 13:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-28 17:37 [PATCH 00/10] nohz: Support sysidle (+ some more nohz kick cleanups) Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 01/10] smp: Introduce void kick_cpu_async() Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 02/10] nohz: Kick full dynticks timer targets with an empty IPI Frederic Weisbecker
2014-07-29 11:33 ` Peter Zijlstra
2014-07-29 21:53 ` Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 03/10] rcu: Kick full dynticks CPU on extended grace period with kick_cpu_async() Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 04/10] nohz: Appropriate timekeeper kick on sysidle break Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 05/10] smp: Fast path check on IPI list Frederic Weisbecker
2014-07-29 12:07 ` Peter Zijlstra
2014-07-29 21:54 ` Frederic Weisbecker
2014-07-29 21:55 ` Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 06/10] nohz: Define meaningful symbol for nohz full timekeeper Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 07/10] nohz: Enforce timekeeping on CPU 0 Frederic Weisbecker
2014-07-29 12:12 ` Peter Zijlstra
2014-07-30 13:23 ` Frederic Weisbecker [this message]
2014-07-28 17:37 ` [PATCH 08/10] nohz: Fetch timekeeping max deferment only for timekeeper Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 09/10] nohz: Switch nohz full timekeeper to dynticks idle on top of sysidle detection Frederic Weisbecker
2014-07-29 12:17 ` Peter Zijlstra
2014-07-29 22:04 ` Frederic Weisbecker
2014-07-28 17:37 ` [PATCH 10/10] nohz: Warn on illegal timekeeper switch in nohz full Frederic Weisbecker
-- strict thread matches above, loose matches on Subject: below --
2014-07-19 0:44 [RFC PATCH 00/10] nohz: Support sysidle (and some more cleanups) 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
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=20140730132333.GA18158@localhost.localdomain \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=nicolas.pitre@linaro.org \
--cc=paulmck@linux.vnet.ibm.com \
--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