All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Anna-Maria Gleixner <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mingo@kernel.org, ebiederm@xmission.com, bigeasy@linutronix.de,
	paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, anna-maria@linutronix.de, hpa@zytor.com
Subject: [tip:core/urgent] signal: Remove no longer required irqsave/restore
Date: Thu, 7 Jun 2018 13:21:57 -0700	[thread overview]
Message-ID: <tip-e79e0f38083e607da5d7b493e7a0f78ba38d788e@git.kernel.org> (raw)
In-Reply-To: <20180504144014.5378-1-bigeasy@linutronix.de>

Commit-ID:  e79e0f38083e607da5d7b493e7a0f78ba38d788e
Gitweb:     https://git.kernel.org/tip/e79e0f38083e607da5d7b493e7a0f78ba38d788e
Author:     Anna-Maria Gleixner <anna-maria@linutronix.de>
AuthorDate: Fri, 4 May 2018 16:40:14 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 7 Jun 2018 22:18:55 +0200

signal: Remove no longer required irqsave/restore

Commit a841796f11c9 ("signal: align __lock_task_sighand() irq disabling and
RCU") introduced a rcu read side critical section with interrupts
disabled. The changelog suggested that a better long-term fix would be "to
make rt_mutex_unlock() disable irqs when acquiring the rt_mutex structure's
->wait_lock".

This long-term fix has been made in commit 4abf91047cf ("rtmutex: Make >
wait_lock irq safe") for different reason.

Therefore revert commit a841796f11c9 ("signal: align >
__lock_task_sighand() irq disabling and RCU") as the interrupt disable
dance is not longer required.

Testing was done over an extensive period with RCU torture, especially with
TREE03 as requested by Paul.

Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Link: https://lkml.kernel.org/r/20180504144014.5378-1-bigeasy@linutronix.de
---
 kernel/signal.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 0f865d67415d..8d8a940422a8 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1244,19 +1244,12 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
 {
 	struct sighand_struct *sighand;
 
+	rcu_read_lock();
 	for (;;) {
-		/*
-		 * Disable interrupts early to avoid deadlocks.
-		 * See rcu_read_unlock() comment header for details.
-		 */
-		local_irq_save(*flags);
-		rcu_read_lock();
 		sighand = rcu_dereference(tsk->sighand);
-		if (unlikely(sighand == NULL)) {
-			rcu_read_unlock();
-			local_irq_restore(*flags);
+		if (unlikely(sighand == NULL))
 			break;
-		}
+
 		/*
 		 * This sighand can be already freed and even reused, but
 		 * we rely on SLAB_TYPESAFE_BY_RCU and sighand_ctor() which
@@ -1268,15 +1261,12 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
 		 * __exit_signal(). In the latter case the next iteration
 		 * must see ->sighand == NULL.
 		 */
-		spin_lock(&sighand->siglock);
-		if (likely(sighand == tsk->sighand)) {
-			rcu_read_unlock();
+		spin_lock_irqsave(&sighand->siglock, *flags);
+		if (likely(sighand == tsk->sighand))
 			break;
-		}
-		spin_unlock(&sighand->siglock);
-		rcu_read_unlock();
-		local_irq_restore(*flags);
+		spin_unlock_irqrestore(&sighand->siglock, *flags);
 	}
+	rcu_read_unlock();
 
 	return sighand;
 }

  parent reply	other threads:[~2018-06-07 20:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-04 14:40 [PATCH] kernel/signal: Remove no longer required irqsave/restore Sebastian Andrzej Siewior
2018-05-04 16:59 ` Eric W. Biederman
2018-05-04 17:04   ` Sebastian Andrzej Siewior
2018-05-04 17:17     ` Eric W. Biederman
2018-05-04 17:52       ` Paul E. McKenney
2018-05-04 19:03         ` Eric W. Biederman
2018-05-04 19:45           ` Paul E. McKenney
2018-05-04 20:08             ` Eric W. Biederman
2018-05-04 20:37               ` Paul E. McKenney
2018-05-05  4:38                 ` Eric W. Biederman
2018-05-05  5:25                   ` Paul E. McKenney
2018-05-05  5:56                     ` Thomas Gleixner
2018-05-08 13:42                       ` Anna-Maria Gleixner
2018-05-08 14:53                         ` Paul E. McKenney
2018-05-08 15:49                           ` Anna-Maria Gleixner
2018-05-08 16:53                             ` Paul E. McKenney
2018-06-07 20:21 ` tip-bot for Anna-Maria Gleixner [this message]
2018-05-25  9:05 [PATCH v2 2/2] signal: " Anna-Maria Gleixner
2018-06-10  4:19 ` [tip:core/urgent] " tip-bot for Anna-Maria 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=tip-e79e0f38083e607da5d7b493e7a0f78ba38d788e@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=anna-maria@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.