Skip to contentSkip to conversation

rcu: Fix up pending cbs check in rcu_prepare_for_idle

PATCH In review Neeraj Upadhyay 2 participants 4 messages Aug 7, 2017 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcu: Fix up pending cbs check in rcu_prepare_for_idle

Pending cbs check in rcu_prepare_for_idle is inversed in the sense that, it should accelerate if there are pending cbs; but, the check does the opposite. So, fix it.

Fixes 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 908b309..b8f51df 100644
@@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
 	rdtp->last_accelerate = jiffies;
 	for_each_rcu_flavor(rsp) {
 		rdp = this_cpu_ptr(rsp->rda);
-		if (rcu_segcblist_pend_cbs(&rdp->cblist))
+		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
 			continue;
 		rnp = rdp->mynode;
 		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
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
#1 lore raw
Quoted 7 lines · Neeraj Upadhyay

Pending cbs check in rcu_prepare_for_idle is inversed in the sense that, it should accelerate if there are pending cbs; but, the check does the opposite. So, fix it.

Fixes 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")

Good catch! Queued for review and testing.

Just out of curiosity, how did you find this one?

Thanx, Paul

Quoted 21 lines
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 908b309..b8f51df 100644
@@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
 	rdtp->last_accelerate = jiffies;
 	for_each_rcu_flavor(rsp) {
 		rdp = this_cpu_ptr(rsp->rda);
-		if (rcu_segcblist_pend_cbs(&rdp->cblist))
+		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
 			continue;
 		rnp = rdp->mynode;
 		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
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
#2 lore raw
Quoted 6 lines · Paul E. McKenney
Quoted 5 lines · Neeraj Upadhyay

Pending cbs check in rcu_prepare_for_idle is inversed in the sense that, it should accelerate if there are pending cbs; but, the check does the opposite. So, fix it.

Quoted 7 lines
Quoted 2 lines
Fixes 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")

Good catch! Queued for review and testing.

Just out of curiosity, how did you find this one?

Thanx, Paul

Hi Paul, found the issue while reading the code.

Quoted 22 lines
Quoted 22 lines
---
  kernel/rcu/tree_plugin.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 908b309..b8f51df 100644
@@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
  	rdtp->last_accelerate = jiffies;
  	for_each_rcu_flavor(rsp) {
  		rdp = this_cpu_ptr(rsp->rda);
-		if (rcu_segcblist_pend_cbs(&rdp->cblist))
+		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
  			continue;
  		rnp = rdp->mynode;
  		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
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
#3 lore raw
Quoted 9 lines · Neeraj Upadhyay
Quoted 6 lines · Paul E. McKenney
Quoted 5 lines · Neeraj Upadhyay

Pending cbs check in rcu_prepare_for_idle is inversed in the sense that, it should accelerate if there are pending cbs; but, the check does the opposite. So, fix it.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Fixes 15fecf89e46a ("srcu: Abstract multi-tail callback list handling")

Good catch! Queued for review and testing.

Just out of curiosity, how did you find this one?

Hi Paul, found the issue while reading the code.

Very good, and please feel free to continue reading and finding more bugs! ;-)

Thanx, Paul

Quoted 26 lines
Quoted 21 lines
Quoted 21 lines
---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 908b309..b8f51df 100644
@@ -1493,7 +1493,7 @@ static void rcu_prepare_for_idle(void)
 	rdtp->last_accelerate = jiffies;
 	for_each_rcu_flavor(rsp) {
 		rdp = this_cpu_ptr(rsp->rda);
-		if (rcu_segcblist_pend_cbs(&rdp->cblist))
+		if (!rcu_segcblist_pend_cbs(&rdp->cblist))
 			continue;
 		rnp = rdp->mynode;
 		raw_spin_lock_rcu_node(rnp); /* irqs already disabled. */
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