diff options
author | Himangi Saraogi <himangi774@gmail.com> | 2014-03-12 12:16:46 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-04-29 11:44:41 -0400 |
commit | af952b919bf9e2cf3c4e839359cfd033d98aa011 (patch) | |
tree | b89862c9419234d838c1de2177207c66f0735b69 /kernel/rcu | |
parent | a235c0916543d8b886405f8871dc644124c7cf78 (diff) |
rcu: Protect uses of ->jiffies_stall with ACCESS_ONCE()
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>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r-- | kernel/rcu/tiny_plugin.h | 8 |
1 files 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) | |||
144 | return; | 144 | return; |
145 | rcp->ticks_this_gp++; | 145 | rcp->ticks_this_gp++; |
146 | j = jiffies; | 146 | j = jiffies; |
147 | js = rcp->jiffies_stall; | 147 | js = ACCESS_ONCE(rcp->jiffies_stall); |
148 | if (*rcp->curtail && ULONG_CMP_GE(j, js)) { | 148 | if (*rcp->curtail && ULONG_CMP_GE(j, js)) { |
149 | pr_err("INFO: %s stall on CPU (%lu ticks this GP) idle=%llx (t=%lu jiffies q=%ld)\n", | 149 | pr_err("INFO: %s stall on CPU (%lu ticks this GP) idle=%llx (t=%lu jiffies q=%ld)\n", |
150 | rcp->name, rcp->ticks_this_gp, rcu_dynticks_nesting, | 150 | rcp->name, rcp->ticks_this_gp, rcu_dynticks_nesting, |
@@ -152,17 +152,17 @@ static void check_cpu_stall(struct rcu_ctrlblk *rcp) | |||
152 | dump_stack(); | 152 | dump_stack(); |
153 | } | 153 | } |
154 | if (*rcp->curtail && ULONG_CMP_GE(j, js)) | 154 | if (*rcp->curtail && ULONG_CMP_GE(j, js)) |
155 | rcp->jiffies_stall = jiffies + | 155 | ACCESS_ONCE(rcp->jiffies_stall) = jiffies + |
156 | 3 * rcu_jiffies_till_stall_check() + 3; | 156 | 3 * rcu_jiffies_till_stall_check() + 3; |
157 | else if (ULONG_CMP_GE(j, js)) | 157 | else if (ULONG_CMP_GE(j, js)) |
158 | rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check(); | 158 | ACCESS_ONCE(rcp->jiffies_stall) = jiffies + rcu_jiffies_till_stall_check(); |
159 | } | 159 | } |
160 | 160 | ||
161 | static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp) | 161 | static void reset_cpu_stall_ticks(struct rcu_ctrlblk *rcp) |
162 | { | 162 | { |
163 | rcp->ticks_this_gp = 0; | 163 | rcp->ticks_this_gp = 0; |
164 | rcp->gp_start = jiffies; | 164 | rcp->gp_start = jiffies; |
165 | rcp->jiffies_stall = jiffies + rcu_jiffies_till_stall_check(); | 165 | ACCESS_ONCE(rcp->jiffies_stall) = jiffies + rcu_jiffies_till_stall_check(); |
166 | } | 166 | } |
167 | 167 | ||
168 | static void check_cpu_stalls(void) | 168 | static void check_cpu_stalls(void) |