linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Rik van Riel <riel@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] document ->sighand protection, rcu_read_unlock() deadlocks
Date: Sun, 28 Sep 2014 23:43:57 +0200	[thread overview]
Message-ID: <20140928214357.GA17874@redhat.com> (raw)
In-Reply-To: <20140922164404.GA28910@redhat.com>

Paul, could you take these 2 doc patches? Assuming that you agree
with the comments, of course.

On 09/24, Paul E. McKenney wrote:
>
> On Tue, Sep 23, 2014 at 09:03:48PM +0200, Oleg Nesterov wrote:
> >
> > Paul, will you agree if we turn it into
> > ...
> >      /*
> >       * On the succesfull return we hold ->siglock. According to comment
> >       * above rcu_read_unlock() this is against the rules, but scheduler
> >       * locks are fine under this lock, signal_wake_up() takes them too.
> >       */
> >      rcu_read_unlock();
>
> If you guys continue the guarantee of no deadlock, I am OK with this change.

Heh. Contrary to what I said (and you all were agree ;), this deadlock
is actually possible, so we can not remove the deadlock-avoidance from
__lock_task_sighand(). And I do not see how we can cleanup this code
because preempt_disable() + spin_lock() is not -rt friendly.

I think this deserves a bit of documentation, see 2/2. Perhaps this is
just me, but imo the current comment is a bit misleading.

"if the caller of rcu_read_unlock() already holds one of these locks ..."
is not a problem in fact. I mean, pi_lock or rq->lock are special enough,
nobody should ever call the outermost rcu_read_unlock() with these locks
held. rt_mutex->wait_lock should be fine too, also because ->boost_mtx
is private to rcu_boost() and rcu_read_unlock_special().

But. They can race with each other, and that is why rcu_read_unlock()
under (say) ->siglock can actually lead to deadlock. And only because
rt_mutex->wait_lock doesn't disable irqs. Or I am totally confused.

Perhaps we can change rtmutex.c to use raw_spin_lock_irqsave(), or do
something else...

Oleg.

 include/linux/rcupdate.h |    4 +++-
 kernel/fork.c            |    5 ++++-
 kernel/signal.c          |   12 +++++++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)


  parent reply	other threads:[~2014-09-28 21:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 16:44 [PATCH 0/2] signal: simplify/document lock_task_sighand() logic Oleg Nesterov
2014-09-22 16:44 ` [PATCH 1/2] signal: simplify deadlock-avoidance in lock_task_sighand() Oleg Nesterov
2014-09-22 18:58   ` Steven Rostedt
2014-09-22 19:11     ` Oleg Nesterov
2014-09-22 21:24       ` Steven Rostedt
2014-09-23 11:45         ` Rik van Riel
2014-09-23 14:20           ` Peter Zijlstra
2014-09-23 14:30             ` Steven Rostedt
2014-09-23 19:03         ` Oleg Nesterov
2014-09-24  8:36           ` Paul E. McKenney
2014-09-23 15:55   ` Peter Zijlstra
2014-09-22 16:44 ` [PATCH 2/2] signal: document the RCU protection of ->sighand Oleg Nesterov
2014-09-22 19:00   ` Steven Rostedt
2014-09-23 11:50   ` Rik van Riel
2014-09-28 21:43 ` Oleg Nesterov [this message]
2014-09-28 21:44   ` [PATCH v2 1/2] " Oleg Nesterov
2014-09-28 21:44   ` [PATCH v2 2/2] rcu: more info about potential deadlocks with rcu_read_unlock() Oleg Nesterov
2014-10-23 19:56   ` [PATCH v2 0/2] document ->sighand protection, rcu_read_unlock() deadlocks Oleg Nesterov
2014-10-23 20:29     ` Paul E. McKenney

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=20140928214357.GA17874@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).