mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, laijs@cn.fujitsu.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
	peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com,
	edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com,
	oleg@redhat.com, sbw@mit.edu,
	Himangi Saraogi <himangi774@gmail.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [PATCH tip/core/rcu 09/19] rcu: Protect uses of ->jiffies_stall with ACCESS_ONCE()
Date: Mon, 28 Apr 2014 16:56:22 -0700	[thread overview]
Message-ID: <1398729392-15087-9-git-send-email-paulmck@linux.vnet.ibm.com> (raw)
In-Reply-To: <1398729392-15087-1-git-send-email-paulmck@linux.vnet.ibm.com>

From: Himangi Saraogi <himangi774@gmail.com>

Some of the accesses to the rcu_state structure's ->jiffies_stall
field are unprotected. This patch protects them with ACCESS_ONCE().
The following coccinelle script was used to acheive this:
/* coccinelle script to protect uses of ->jiffies_stall with ACCESS_ONCE() */
@@
identifier a;
@@
(
	ACCESS_ONCE(a->jiffies_stall)
|
-	a->jiffies_stall
+	ACCESS_ONCE(a->jiffies_stall)
)

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/tiny_plugin.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/tiny_plugin.h b/kernel/rcu/tiny_plugin.h
index 431528520562..858c56569127 100644
--- a/kernel/rcu/tiny_plugin.h
+++ b/kernel/rcu/tiny_plugin.h
@@ -144,7 +144,7 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp)
 		return;
 	rcp->ticks_this_gp++;
 	j = jiffies;
-	js = rcp->jiffies_stall;
+	js = ACCESS_ONCE(rcp->jiffies_stall);
 	if (*rcp->curtail && ULONG_CMP_GE(j, js)) {
 		pr_err("INFO: %s stall on CPU (%lu ticks this GP) idle=%llx (t=%lu jiffies q=%ld)\n",
 		       rcp->name, rcp->ticks_this_gp, rcu_dynticks_nesting,
@@ -152,17 +152,17 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp)
 		dump_stack();
 	}
 	if (*rcp->curtail && ULONG_CMP_GE(j, js))
-		rcp->jiffies_stall = jiffies +
+		ACCESS_ONCE(rcp->jiffies_stall) = jiffies +
 			3 * rcu_jiffies_till_stall_check() + 3;
 	else if (ULONG_CMP_GE(j, js))
-		rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
+		ACCESS_ONCE(rcp->jiffies_stall) = jiffies + rcu_jiffies_till_stall_check();
 }
 
 static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp)
 {
 	rcp->ticks_this_gp = 0;
 	rcp->gp_start = jiffies;
-	rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check();
+	ACCESS_ONCE(rcp->jiffies_stall) = jiffies + rcu_jiffies_till_stall_check();
 }
 
 static void check_cpu_stalls(void)
-- 
1.8.1.5


  parent reply	other threads:[~2014-04-28 23:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-28 23:56 [PATCH tip/core/rcu 0/3] Miscellaneous fixes for 3.16 Paul E. McKenney
2014-04-28 23:56 ` [PATCH tip/core/rcu 01/19] rcu: Protect ->gp_flags accesses with ACCESS_ONCE() Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 02/19] rcu: Fix incorrect notes for code Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 03/19] rcu: Print negatives for stall-warning counter wraparound Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 04/19] rcu: Update cpu_needs_another_gp() for futures from non-NOCB CPUs Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 05/19] rcu: Remove unused rcu_data structure field Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 06/19] rcu: Protect uses of jiffies_stall field with ACCESS_ONCE() Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 07/19] rcu: Make callers awaken grace-period kthread Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 08/19] rcu: Remove "extern" from function declaration in include/linux/rcupdate.h Paul E. McKenney
2014-04-28 23:56   ` Paul E. McKenney [this message]
2014-04-28 23:56   ` [PATCH tip/core/rcu 10/19] rcu: Add event tracing to dyntick_save_progress_counter() Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 11/19] rcu: Replace NR_CPUS with nr_cpu_ids Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 12/19] rcu: Consolidate kfree_call_rcu() to use rcu_state pointer Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 13/19] rcu: Merge rcu_sched_force_quiescent_state() with rcu_force_quiescent_state() Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 14/19] rcu: Document RCU_INIT_POINTER()'s lack of ordering guarantees Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 15/19] rcu: Bind RCU grace-period kthreads if NO_HZ_FULL Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 16/19] rcu: Make large and small sysidle systems use same state machine Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 17/19] rcu: Remove duplicate resched_cpu() declaration Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 18/19] rcu: Replace __this_cpu_ptr() uses with raw_cpu_ptr() Paul E. McKenney
2014-04-28 23:56   ` [PATCH tip/core/rcu 19/19] softirq: A single rcu_bh_qs() call per softirq set is enough Paul E. McKenney
2014-04-29  3:23 ` [PATCH tip/core/rcu 0/3] Miscellaneous fixes for 3.16 Josh Triplett
2014-04-29 15:46   ` 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=1398729392-15087-9-git-send-email-paulmck@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=darren@dvhart.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=himangi774@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=niv@us.ibm.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sbw@mit.edu \
    --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

Powered by JetHome