Skip to contentSkip to conversation

rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value

RFC PATCH In review Dongdong Deng 2 participants 4 messages Sep 28, 2010 – Oct 7, 2010

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value

Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value due to the caller didn't hold the root_rcu/rnp node's lock.

CC Dipankar Sarma <[email protected]>
CC Paul E. McKenney <[email protected]>
---
 kernel/rcutree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/rcutree.c +2 -2
index d5bc439..07a7063 100644
@@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	if (rcu_cpu_stall_panicking)
 		return;
-	delta = jiffies - rsp->jiffies_stall;
+	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
 	rnp = rdp->mynode;
-	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
+	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
 
 		/* We haven't checked in, so go dump stack. */
 		print_cpu_stall(rsp);
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 2 lines · Dongdong Deng

Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value due to the caller didn't hold the root_rcu/rnp node's lock.

Given that the quantities are only used once, ACCESS_ONCE() is strictly speaking not necessary. I am tempted to queue your patch regardless for the documentation benefits.

Or is this patch necessary to fix a failure that you have been seeing?

In any case, thank you for taking a look at RCU!

Thanx, Paul

Quoted 26 lines
CC Dipankar Sarma <[email protected]>
CC Paul E. McKenney <[email protected]>
---
 kernel/rcutree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/rcutree.c +2 -2
index d5bc439..07a7063 100644
@@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	if (rcu_cpu_stall_panicking)
 		return;
-	delta = jiffies - rsp->jiffies_stall;
+	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
 	rnp = rdp->mynode;
-	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
+	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
 
 		/* We haven't checked in, so go dump stack. */
 		print_cpu_stall(rsp);
Signature · 1 line
1.6.0.4
author
#2 lore raw
Quoted 9 lines · Paul E. McKenney
Quoted 2 lines · Dongdong Deng

Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value due to the caller didn't hold the root_rcu/rnp node's lock.

Given that the quantities are only used once, ACCESS_ONCE() is strictly speaking not necessary. I am tempted to queue your patch regardless for the documentation benefits.

Or is this patch necessary to fix a failure that you have been seeing?

Hello Pual,

No, I didn't see a failure about it.
I got this patch from code review. :-)

Thanks,
Dongdong

Quoted 31 lines

In any case, thank you for taking a look at RCU!

Thanx, Paul

Quoted 26 lines
CC Dipankar Sarma <[email protected]>
CC Paul E. McKenney <[email protected]>
---
 kernel/rcutree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/rcutree.c +2 -2
index d5bc439..07a7063 100644
@@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	if (rcu_cpu_stall_panicking)
 		return;
-	delta = jiffies - rsp->jiffies_stall;
+	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
 	rnp = rdp->mynode;
-	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
+	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
 
 		/* We haven't checked in, so go dump stack. */
 		print_cpu_stall(rsp);
Signature · 1 line
1.6.0.4
#3 lore raw
Quoted 9 lines · DDD
Quoted 8 lines · Paul E. McKenney
Quoted 2 lines · Dongdong Deng

Using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value due to the caller didn't hold the root_rcu/rnp node's lock.

Given that the quantities are only used once, ACCESS_ONCE() is strictly speaking not necessary. I am tempted to queue your patch regardless for the documentation benefits.

Quoted 6 lines
Quoted 1 line

Or is this patch necessary to fix a failure that you have been seeing?

Hello Pual,

No, I didn't see a failure about it.
I got this patch from code review. :-)

Thank you for the info, patch queued.

Thanx, Paul

Quoted 36 lines

Thanks,
Dongdong

Quoted 31 lines

In any case, thank you for taking a look at RCU!

Thanx, Paul

Quoted 26 lines
CC Dipankar Sarma <[email protected]>
CC Paul E. McKenney <[email protected]>

---
kernel/rcutree.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
kernel/rcutree.c +2 -2
index d5bc439..07a7063 100644
@@ -532,9 +532,9 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
 
 	if (rcu_cpu_stall_panicking)
 		return;
-	delta = jiffies - rsp->jiffies_stall;
+	delta = jiffies - ACCESS_ONCE(rsp->jiffies_stall);
 	rnp = rdp->mynode;
-	if ((rnp->qsmask & rdp->grpmask) && delta >= 0) {
+	if ((ACCESS_ONCE(rnp->qsmask) & rdp->grpmask) && delta >= 0) {
 
 		/* We haven't checked in, so go dump stack. */
 		print_cpu_stall(rsp);
Signature · 1 line
1.6.0.4