rcu: using ACCESS_ONCE() to observe the jiffies_stall/rnp->qsmask value
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.
--- kernel/rcutree.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/rcutree.c +2 -2
@@ -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
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
Signed-off-by Dongdong Deng <[email protected]>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@@ -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
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
Signed-off-by Dongdong Deng <[email protected]>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@@ -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
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,
DongdongQuoted 31 lines
In any case, thank you for taking a look at RCU!
Thanx, Paul
Quoted 26 lines
Signed-off-by Dongdong Deng <[email protected]>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@@ -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