rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
PATCH 1/1 rcu: tree_stall: Correctly unlock root node in rcu_check_gp_start_stall
Only unlock the root node, if current node (rnp) is not root node.
--- kernel/rcu/tree_stall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/rcu/tree_stall.h +3 -1
@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp, time_before(j, rcu_state.gp_req_activity + gpssdelay) || time_before(j, rcu_state.gp_activity + gpssdelay) || atomic_xchg(&warned, 1)) { -raw_spin_unlock_rcu_node (rnp_root);/* irqs remain disabled. */ +if (rnp_root != rnp) +/* irqs remain disabled. */ +raw_spin_unlock_rcu_node (rnp_root);raw_spin_unlock_irqrestore_rcu_node (rnp, flags);return ; }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
kernel/rcu/tree_stall.h
Quoted 15 lines · Neeraj Upadhyay
Only unlock the root node, if current node (rnp) is not root node.
Signed-off-by Neeraj Upadhyay <[email protected]>--- kernel/rcu/tree_stall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)kernel/rcu/tree_stall.h +0
-0
why this is showing as under tree_stall.h while it is under "kernel/rcu/tree.c"
kernel/rcu/tree_stall.h static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp, · line 635
Quoted 8 lines
kernel/rcu/tree_stall.h +3
-1@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp, time_before(j, rcu_state.gp_req_activity + gpssdelay) || time_before(j, rcu_state.gp_activity + gpssdelay) || atomic_xchg(&warned, 1)) { -raw_spin_unlock_rcu_node (rnp_root);/* irqs remain disabled. */ +if (rnp_root != rnp) +/* irqs remain disabled. */ +raw_spin_unlock_rcu_node (rnp_root);
Looks good as it will balance the lock .if it is the root_node, which was not there earlier, and unlock was happening without any lock on root.
Cheers,
-Mukesh
Quoted 3 lines
kernel/rcu/tree_stall.h +0
-0raw_spin_unlock_irqrestore_rcu_node (rnp, flags);return ; }
Quoted 13 lines · Mukesh Ojha
Quoted 11 lines · Neeraj Upadhyay
Only unlock the root node, if current node (rnp) is not root node.
Signed-off-by Neeraj Upadhyay <[email protected]>---
kernel/rcu/tree_stall.h| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 7 lines
kernel/rcu/tree_stall.h
Quoted 4 lines
kernel/rcu/tree_stall.h +0
-0why this is showing as under
tree_stall.hwhile it is under "kernel/rcu/tree.c"
Please see linux-rcu dev tree for other changes, which moves code to this file.
Thanks
Neeraj
Quoted 21 lines
Quoted 10 lines
kernel/rcu/tree_stall.h +0
-0@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
time_before(j, rcu_state.gp_req_activity + gpssdelay)||time_before(j, rcu_state.gp_activity + gpssdelay)||atomic_xchg(&warned, 1)) {
-raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */ + if (rnp_root!= rnp)
+ /* irqs remain disabled. */
+raw_spin_unlock_rcu_node(rnp_root);Looks good as it will balance the lock .if it is the
root_node, which was not there earlier, and unlock was happening without any lock on root.Reviewed-by Mukesh Ojha <[email protected]>Cheers,
-MukeshQuoted 3 lines
raw_spin_unlock_irqrestore_rcu_node(rnp, flags); return;
}
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Paul E. McKenney
AppliedQuoted 25 lines · Neeraj Upadhyay
Quoted 13 lines · Mukesh Ojha
Quoted 11 lines · Neeraj Upadhyay
Only unlock the root node, if current node (rnp) is not root node.
Signed-off-by Neeraj Upadhyay <[email protected]>---
kernel/rcu/tree_stall.h| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Quoted 8 lines
kernel/rcu/tree_stall.h
Quoted 4 lines
kernel/rcu/tree_stall.h +0
-0why this is showing as under
tree_stall.hwhile it is under "kernel/rcu/tree.c"
Quoted 25 lines
Please see linux-rcu dev tree for other changes, which moves code to this file.
Thanks
NeerajQuoted 16 lines
Quoted 10 lines
kernel/rcu/tree_stall.h +0
-0@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
time_before(j, rcu_state.gp_req_activity + gpssdelay)||time_before(j, rcu_state.gp_activity + gpssdelay)||atomic_xchg(&warned, 1)) {
-raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */ + if (rnp_root!= rnp)
+ /* irqs remain disabled. */
+raw_spin_unlock_rcu_node(rnp_root);Looks good as it will balance the lock .if it is the
root_node, which was not there earlier, and unlock was happening without any lock on root.Reviewed-by Mukesh Ojha <[email protected]>
Applied, again thank you both!
In both cases, I updated the commit log, so please check to make sure that I didn't mess anything up.
Thanx, Paul
Quoted 11 lines
Quoted 6 lines
Cheers,
-MukeshQuoted 3 lines
raw_spin_unlock_irqrestore_rcu_node(rnp, flags); return;
}Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 50 lines · Paul E. McKenney
Quoted 49 lines · Neeraj Upadhyay
Quoted 13 lines · Mukesh Ojha
Quoted 11 lines · Neeraj Upadhyay
Only unlock the root node, if current node (rnp) is not root node.
Signed-off-by Neeraj Upadhyay <[email protected]>--- kernel/rcu/tree_stall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Quoted 8 lines
kernel/rcu/tree_stall.h
Quoted 4 lines
kernel/rcu/tree_stall.h +0
-0why this is showing as under
tree_stall.hwhile it is under "kernel/rcu/tree.c"Please see linux-rcu dev tree for other changes, which moves code to this file.
Thanks
NeerajQuoted 15 lines
kernel/rcu/tree_stall.h static void rcu_check_gp_start_stall(struct · line 636
Quoted 10 lines
kernel/rcu/tree_stall.h +3
-1@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp, time_before(j, rcu_state.gp_req_activity + gpssdelay) || time_before(j, rcu_state.gp_activity + gpssdelay) || atomic_xchg(&warned, 1)) { - raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */ + if (rnp_root != rnp) + /* irqs remain disabled. */ + raw_spin_unlock_rcu_node(rnp_root);Looks good as it will balance the lock .if it is the
root_node, which was not there earlier, and unlock was happening without any lock on root.
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Reviewed-by Mukesh Ojha <[email protected]>Applied, again thank you both!
In both cases, I updated the commit log, so please check to make sure that I didn't mess anything up.
Thanx, Paul
Thanks Paul. One minor comment on https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=ec6530e763046b6bb1f4c2c2aed49ebc68aae2a0
"it clearly does not make sense to release
both rnp->lock and rnp->lock"
should be rnp->lock and rnp_root->lock
Thanks
Neeraj
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Cheers,
-MukeshQuoted 3 lines
kernel/rcu/tree_stall.h +0
-0raw_spin_unlock_irqrestore_rcu_node(rnp, flags); return;}
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Quoted 61 lines · Neeraj Upadhyay
Quoted 50 lines · Paul E. McKenney
Quoted 49 lines · Neeraj Upadhyay
Quoted 13 lines · Mukesh Ojha
Quoted 11 lines · Neeraj Upadhyay
Only unlock the root node, if current node (rnp) is not root node.
Signed-off-by Neeraj Upadhyay <[email protected]>---
kernel/rcu/tree_stall.h| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Quoted 8 lines
kernel/rcu/tree_stall.h
Quoted 4 lines
kernel/rcu/tree_stall.h +0
-0why this is showing as under
tree_stall.hwhile it is under "kernel/rcu/tree.c"Please see linux-rcu dev tree for other changes, which moves code to this file.
Thanks
NeerajQuoted 15 lines
Quoted 10 lines
kernel/rcu/tree_stall.h +0
-0@@ -630,7 +630,9 @@ static void rcu_check_gp_start_stall(struct rcu_node *rnp, struct rcu_data *rdp,
time_before(j, rcu_state.gp_req_activity + gpssdelay)||time_before(j, rcu_state.gp_activity + gpssdelay)||atomic_xchg(&warned, 1)) {
-raw_spin_unlock_rcu_node(rnp_root); /* irqs remain disabled. */ + if (rnp_root!= rnp)
+ /* irqs remain disabled. */
+raw_spin_unlock_rcu_node(rnp_root);Looks good as it will balance the lock .if it is the
root_node, which was not there earlier, and unlock was happening without any lock on root.Quoted 9 lines
Quoted 1 line
Quoted 1 line
Reviewed-by Mukesh Ojha <[email protected]>Applied, again thank you both!
In both cases, I updated the commit log, so please check to make sure that I didn't mess anything up.
Thanx, Paul
Quoted 7 lines
Thanks Paul. One minor comment on https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=ec6530e763046b6bb1f4c2c2aed49ebc68aae2a0
"it clearly does not make sense to release
bothrnp->lockandrnp->lock"should be
rnp->lockandrnp_root->lock
Good eyes, fixed, thank you!
Thanx, Paul
Quoted 20 lines
Thanks
NeerajQuoted 12 lines
Quoted 11 lines
Quoted 6 lines
Cheers,
-MukeshQuoted 3 lines
raw_spin_unlock_irqrestore_rcu_node(rnp, flags); return;
}Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux FoundationSignature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation