mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	"Pan, Jacob jun" <jacob.jun.pan@intel.com>,
	LKML <linux-kernel@vger.kernel.org>, LKP <lkp@01.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [nohz] 2a16fc93d2c: kernel lockup on idle injection
Date: Tue, 16 Dec 2014 15:50:39 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1412161533210.17382@nanos> (raw)
In-Reply-To: <20141216142029.GA27375@lerouge>

On Tue, 16 Dec 2014, Frederic Weisbecker wrote:
> On Tue, Dec 16, 2014 at 01:49:03PM +0100, Thomas Gleixner wrote:
> > And that's where the whole problem starts. The nohz full stuff is
> > trying to evaluate everything dynamically which is just insane.
> > 
> > So we want to have functions which do:
> > 
> >    tick_nohz_full_enter()
> >      ts->infullnohz = true;
> >      if (stop_possible)
> >      	stop_tick(ts);
> > 
> >    tick_nohz_full_exit()
> >      ts->infullnohz = false;
> >      if (ts->tick_stopped)
> >      	start_tick(ts);
> > 
> > Plus irq_exit would become:     
> > 
> > irq_exit
> > 	if (ts->inidle)
> > 	   tick_nohz_update_sched_tick();
> > 
> > 	else if (ts->infullnohz)
> > 	   tick_nohz_full_update_sched_tick();
> 
> So I can do that indeed. But then it's going to break the jump label that's
> off in 99.99% of the case.

Why so?

> Now I can wrap that into parallel functions:
> 
> irq_exit
> 	if (tick_nohz_idle())
> 	   tick_nohz_update_sched_tick();
> 
> 	else if (tick_nohz_full())
> 	   tick_nohz_full_update_sched_tick();
> 
> Just to be sure I understand you well. By ts->infullnohz, you mean
> the fact that a CPU _wants_ to be in full nohz, not whether it _can_
> right? Whether the CPU wants to be in full nohz is decided in
> boottime with nohz_full= parameter.

NO. Whether I read it from ts->infullnohz or from the cpumask is the
same. What I care about is the state change.

In the NOHZ idle case we do not care whether NOHZ=y and nohz=on/off on
the kernel command line. All we care about is ts->inidle and we have
very clear points of changing that state. See below.
 
> Whether it can is dynamically checked on top of scheduler, perf,
> posix cpu timers, etc...

Look at it the same way as idle. We do not care whether the cpu marks
itself as idle at some random place, we care about the internal state
of NOHZ.

>From NOHZ point of view the relevant places are tick_nohz_idle_enter()
and tick_nohz_idle_exit(). We mark that with ts->inidle and we take
care of preparing on enter (evtl. stopping the tick) and cleaning up
on exit (evtl. restarting the tick). And the information that we are
inidle is important in the irq_exit() path. If the NOHZ facility is
NOT inidle then it has nothing to do. You CANNOT rely on asynchronous
state. That simply never works reliably and just leads to band aids
and random state checks all over the place.

Now in the nohz full case, we want proper functions which say:

    this_cpu_enters_nohz_full_now()
and
    this_cpu_exits_nohz_full_now()

So like we do in tick_nohz_idle_enter() and tick_nohz_idle_exit() we
have a clear state change in the nohz code and not something which is
randomly deduced from async state all over the place.

So that only tells the NOHZ core that the rest of the system decided
that the cpu can actually go into full nohz mode. Whether the tick
code disables the tick or not is decided by the tick code.

It's not different from idle.
 
Thanks,

	tglx

  reply	other threads:[~2014-12-16 14:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11 19:42 Fengguang Wu
2014-12-12 11:57 ` Viresh Kumar
2014-12-15  7:25   ` Preeti U Murthy
2014-12-15  9:32     ` Viresh Kumar
2014-12-15  9:43       ` Preeti U Murthy
2014-12-15 21:24         ` Pan, Jacob jun
2014-12-16  4:18           ` Viresh Kumar
2014-12-16 17:15             ` Jacob Pan
2014-12-16 21:15               ` Thomas Gleixner
2014-12-15 23:44       ` Frederic Weisbecker
2014-12-16  4:53         ` Viresh Kumar
2014-12-16  9:36           ` Preeti U Murthy
2014-12-16 12:49             ` Thomas Gleixner
2014-12-16 14:20               ` Frederic Weisbecker
2014-12-16 14:50                 ` Thomas Gleixner [this message]
2014-12-16 21:21                   ` Thomas Gleixner
2014-12-16 22:49                     ` Peter Zijlstra
2014-12-16 22:54                       ` Thomas Gleixner
2014-12-17  0:26                         ` Frederic Weisbecker
2014-12-17  0:12                     ` Frederic Weisbecker
2014-12-17  9:11                       ` Thomas Gleixner
2014-12-17 12:47                         ` Frederic Weisbecker
2014-12-16 14:32               ` Thomas Gleixner
2014-12-16 14:56                 ` Peter Zijlstra
2014-12-16 16:54                   ` Thomas Gleixner
2014-12-17 12:31               ` Preeti Murthy
2014-12-17 15:42                 ` Thomas Gleixner

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=alpine.DEB.2.11.1412161533210.17382@nanos \
    --to=tglx@linutronix.de \
    --cc=fengguang.wu@intel.com \
    --cc=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=jacob.jun.pan@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=peterz@infradead.org \
    --cc=preeti@linux.vnet.ibm.com \
    --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

all inboxes | Powered by JetHome®