linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Carsten Emde <C.Emde@osadl.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	John Kacur <jkacur@redhat.com>, <stable-rt@vger.kernel.org>,
	Tiejun Chen <tiejun.chen@windriver.com>,
	Bin Jiang <bin.jiang@windriver.com>
Subject: [PATCH RT 04/11] rcutree/rcu_bh_qs: disable irq while calling rcu_preempt_qs()
Date: Fri, 28 Feb 2014 08:34:58 -0500	[thread overview]
Message-ID: <20140228133535.785759588@goodmis.org> (raw)
In-Reply-To: 20140228133454.373761937@goodmis.org

[-- Attachment #1: 0004-rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch --]
[-- Type: text/plain, Size: 1543 bytes --]

3.10.32-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Tiejun Chen <tiejun.chen@windriver.com>

Any callers to the function rcu_preempt_qs() must disable irqs in
order to protect the assignment to ->rcu_read_unlock_special. In
RT case, rcu_bh_qs() as the wrapper of rcu_preempt_qs() is called
in some scenarios where irq is enabled, like this path,

do_single_softirq()
    |
    + local_irq_enable();
    + handle_softirq()
    |    |
    |    + rcu_bh_qs()
    |        |
    |        + rcu_preempt_qs()
    |
    + local_irq_disable()

So here we'd better disable irq directly inside of rcu_bh_qs() to
fix this, otherwise the kernel may be freezable sometimes as
observed. And especially this way is also kind and safe for the
potential rcu_bh_qs() usage elsewhere in the future.

Cc: stable-rt@vger.kernel.org
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Bin Jiang <bin.jiang@windriver.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/rcutree.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 55915b1..dcb79e9 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -187,7 +187,12 @@ static void rcu_preempt_qs(int cpu);
 
 void rcu_bh_qs(int cpu)
 {
+	unsigned long flags;
+
+	/* Callers to this function, rcu_preempt_qs(), must disable irqs. */
+	local_irq_save(flags);
 	rcu_preempt_qs(cpu);
+	local_irq_restore(flags);
 }
 #else
 void rcu_bh_qs(int cpu)
-- 
1.8.5.3

  parent reply	other threads:[~2014-02-28 13:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28 13:34 [PATCH RT 00/11] Linux 3.10.32-rt31-rc1 Steven Rostedt
2014-02-28 13:34 ` [PATCH RT 01/11] timers: do not raise softirq unconditionally Steven Rostedt
2014-02-28 13:34 ` [PATCH RT 02/11] timer: Raise softirq if theres irq_work Steven Rostedt
2014-02-28 13:34 ` [PATCH RT 03/11] timer/rt: Always raise the softirq if theres irq_work to be done Steven Rostedt
2014-02-28 13:34 ` Steven Rostedt [this message]
2014-02-28 13:34 ` [PATCH RT 05/11] Revert "x86: Disable IST stacks for debug/int 3/stack fault for PREEMPT_RT" Steven Rostedt
2014-02-28 13:35 ` [PATCH RT 06/11] rt: Make cpu_chill() use hrtimer instead of msleep() Steven Rostedt
2014-02-28 13:35 ` [PATCH RT 07/11] kernel/hrtimer: be non-freezeable in cpu_chill() Steven Rostedt
2014-02-28 13:35 ` [PATCH RT 08/11] arm/unwind: use a raw_spin_lock Steven Rostedt
2014-02-28 13:35 ` [PATCH RT 09/11] net: ip_send_unicast_reply: add missing local serialization Steven Rostedt
2014-02-28 13:35 ` [PATCH RT 10/11] leds: trigger: disable CPU trigger on -RT Steven Rostedt
2014-02-28 13:35 ` [PATCH RT 11/11] Linux 3.10.32-rt31-rc1 Steven Rostedt

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=20140228133535.785759588@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=C.Emde@osadl.org \
    --cc=bigeasy@linutronix.de \
    --cc=bin.jiang@windriver.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=stable-rt@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tiejun.chen@windriver.com \
    /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).