public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] stop_machine: Fix deadlock between multiple stop_two_cpus()
Date: Fri, 05 Jun 2015 13:08:14 -0400	[thread overview]
Message-ID: <5571D77E.3080203@redhat.com> (raw)
In-Reply-To: <20150605153023.GH19282@twins.programming.kicks-ass.net>

On 06/05/2015 11:30 AM, Peter Zijlstra wrote:
> 
> Jiri reported a machine stuck in multi_cpu_stop() with
> migrate_swap_stop() as function and with the following src,dst cpu
> pairs: {11,  4} {13, 11} { 4, 13}
> 
>                         4       11      13
> 
> cpuM: queue(4 ,13)
>                         *Ma
> cpuN: queue(13,11)
>                                 *N      Na
>                         *M              Mb
> cpuO: queue(11, 4)
>                         *O      Oa
>                                 *Nb
>                         *Ob
> 
> Where *X denotes the cpu running the queueing of cpu-X and X[ab] denotes
> the first/second queued work.
> 
> You'll observe the top of the workqueue for each cpu: 4,11,13 to be work
> from cpus: M, O, N resp. IOW. deadlock.
> 
> Do away with the queueing trickery and introduce lg_double_lock() to
> lock both CPUs and fully serialize the stop_two_cpus() callers instead
> of the partial (and buggy) serialization we have now.
> 
> Completely untested..
> 
> Reported-by: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Certainly looks like it would work.

I suspect we should probably apply this patch after some basic
testing, since the race is so incredibly hard to reproduce.

-- 
All rights reversed

  reply	other threads:[~2015-06-05 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 15:30 [RFC][PATCH] stop_machine: Fix deadlock between multiple stop_two_cpus() Peter Zijlstra
2015-06-05 17:08 ` Rik van Riel [this message]
2015-06-19 18:00 ` [tip:sched/core] sched/stop_machine: " tip-bot for Peter Zijlstra

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=5571D77E.3080203@redhat.com \
    --to=riel@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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