The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com,
	paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org,
	khilman@linaro.org, tglx@linutronix.de, axboe@fb.com,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:timers/nohz] nohz: Move full nohz kick to its own IPI
Date: Mon, 5 May 2014 17:04:00 +0200	[thread overview]
Message-ID: <20140505150356.GB2099@localhost.localdomain> (raw)
In-Reply-To: <20140505133113.GD1429@laptop.programming.kicks-ass.net>

On Mon, May 05, 2014 at 03:31:13PM +0200, Peter Zijlstra wrote:
> On Mon, May 05, 2014 at 02:37:06PM +0200, Peter Zijlstra wrote:
> > On Wed, Apr 16, 2014 at 12:40:01AM -0700, tip-bot for Frederic Weisbecker wrote:
> > > Commit-ID:  72aacf0259bb7d53b7a3b5b2f7bf982acaa52b61
> > > Gitweb:     http://git.kernel.org/tip/72aacf0259bb7d53b7a3b5b2f7bf982acaa52b61
> > > Author:     Frederic Weisbecker <fweisbec@gmail.com>
> > > AuthorDate: Tue, 18 Mar 2014 21:12:53 +0100
> > > Committer:  Frederic Weisbecker <fweisbec@gmail.com>
> > > CommitDate: Thu, 3 Apr 2014 18:05:21 +0200
> > > 
> > > nohz: Move full nohz kick to its own IPI
> > > 
> > > Now that we have smp_queue_function_single() which can be used to
> > > safely queue IPIs when interrupts are disabled and without worrying
> > > about concurrent callers, lets use it for the full dynticks kick to
> > > notify a CPU that it's exiting single task mode.
> > > 
> > > This unbloats a bit the scheduler IPI that the nohz code was abusing
> > > for its cool "callable anywhere/anytime" properties.
> > > 
> > > Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > Cc: Ingo Molnar <mingo@kernel.org>
> > > Cc: Jens Axboe <axboe@fb.com>
> > > Cc: Kevin Hilman <khilman@linaro.org>
> > > Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > > Cc: Peter Zijlstra <peterz@infradead.org>
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > 
> > So I suspect this is the patch that makes Ingo's machines unhappy, they
> > appear to get stuck thusly:
> > 
> > [10513.382910] RIP: 0010:[<ffffffff8112b7da>]  [<ffffffff8112b7da>] generic_exec_single+0x9a/0x180
> > 
> > [10513.481704]  [<ffffffff8112c092>] smp_queue_function_single+0x42/0xa0
> > [10513.488251]  [<ffffffff81126ce0>] tick_nohz_full_kick_cpu+0x50/0x80
> > [10513.494661]  [<ffffffff810f4b0e>] enqueue_task_fair+0x59e/0x6c0
> > [10513.506469]  [<ffffffff810e3d6a>] enqueue_task+0x3a/0x60
> > [10513.511836]  [<ffffffff810e8ac3>] __migrate_task+0x123/0x150
> > [10513.523535]  [<ffffffff810e8b0d>] migration_cpu_stop+0x1d/0x30
> > [10513.529401]  [<ffffffff81143460>] cpu_stopper_thread+0x70/0x120
> > 
> > I'm not entirely sure how yet, but this is by far the most likely
> > candidate. Ingo, if you still have the vmlinuz matching this trace (your
> > hang2.txt) could you have a peek where that RIP lands?
> > 
> > If that is indeed the csd_lock() function, then this is it and
> > something's buggered.
> 
> On a kernel build from your .config the +0x9a is indeed very close to
> that wait loop; of course 0x9a isn't even an instruction boundary for me
> so its all a bit of a guess.

Note the current ordering:

    cmpxchg(&qsd->pending, 0, 1)       get ipi
    csd_lock(qsd->csd)                 xchg(&qsd->pending, 1)
    send ipi                           csd_unlock(qsd->csd)


So there shouldn't be racing updaters. Also ipi sender shouldn't
race with ipi receiver, the update shouldn't always eventually see
the unlock happening.

OTOH the ordering above is anything but intuitive. In fact csd_lock()
is on the way here. smp_queue_function_single() doesn't need it at
all. So it's just yet another risk for a deadlock.

One more reason why I would much prefer irq_work_queue_on(). But
I'm also not very happy with the possible result since we are going
to maintain two different APIs set doing almost the same thing with
just slightly different constraints or semantics :-(

  reply	other threads:[~2014-05-05 15:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-72aacf0259bb7d53b7a3b5b2f7bf982acaa52b61@git.kernel.org>
2014-05-05 12:37 ` [tip:timers/nohz] nohz: Move full nohz kick to its own IPI Peter Zijlstra
2014-05-05 13:31   ` Peter Zijlstra
2014-05-05 15:04     ` Frederic Weisbecker [this message]
2014-05-05 15:12       ` Peter Zijlstra
2014-05-05 15:34         ` Frederic Weisbecker
2014-05-07 15:17           ` Peter Zijlstra
2014-05-07 15:29             ` Frederic Weisbecker
2014-05-07 15:37               ` Peter Zijlstra
2014-05-07 16:05                 ` Frederic Weisbecker
2014-05-07 16:13                   ` Peter Zijlstra
2014-05-07 19:07                     ` Ingo Molnar
2014-05-09 15:10                       ` Frederic Weisbecker
2014-05-11  5:34                         ` Ingo Molnar
2014-05-05 14:52   ` Frederic Weisbecker
2014-05-05 14:58     ` Peter Zijlstra
2014-05-05 15:06       ` 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=20140505150356.GB2099@localhost.localdomain \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@fb.com \
    --cc=hpa@zytor.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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