Skip to contentSkip to conversation

rcu/exp: Mark current CPU as exp-QS in IPI loop second pass

PATCH Applied Frederic Weisbecker 3 participants 3 messages Nov 30, 2021 RCU

lore
Share & tools
lore

Frederic Weisbecker

author maintainer
#0 lore raw

PATCH 1/1 rcu/exp: Mark current CPU as exp-QS in IPI loop second pass

While looping through the rnp's CPUs to IPI for an expedited grace period, a first pass excludes the current CPU and the CPUs in dynticks idle mode. The workqueue will report their QS on their behalf later.

The second pass processes the IPIs and also ignores the current CPU, assuming it has been previously included in the group of CPUs whose QS are to be reported by the workqueue.

Unfortunately the current CPU may have changed between the first and second pass, due to the rnp lock being dropped, re-enabling preemption. As a result the current CPU, if different in the second pass, may be ignored by the expedited grace period. No IPI will be sent to it so it won't be requested to report an expedited quiescent state.

This ends up in an expedited grace period stall.

Fix this with including the current CPU in the second round in the group of CPUs to report a QS for by the workqueue.

Fixes b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()")
Cc Uladzislau Rezki <[email protected]>
Cc Neeraj Upadhyay <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Joel Fernandes <[email protected]>
---
 kernel/rcu/tree_exp.h | 1 +
 1 file changed, 1 insertion(+)
kernel/rcu/tree_exp.h +1 -0
index a96d17206d87..237a79989aba 100644
@@ -387,6 +387,7 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
 			continue;
 		}
 		if (get_cpu() == cpu) {
+			mask_ofl_test |= mask;
 			put_cpu();
 			continue;
 		}
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Frederic Weisbecker

While looping through the rnp's CPUs to IPI for an expedited grace period, a first pass excludes the current CPU and the CPUs in dynticks idle mode. The workqueue will report their QS on their behalf later.

The second pass processes the IPIs and also ignores the current CPU, assuming it has been previously included in the group of CPUs whose QS are to be reported by the workqueue.

Unfortunately the current CPU may have changed between the first and second pass, due to the rnp lock being dropped, re-enabling preemption. As a result the current CPU, if different in the second pass, may be ignored by the expedited grace period. No IPI will be sent to it so it won't be requested to report an expedited quiescent state.

This ends up in an expedited grace period stall.

Fix this with including the current CPU in the second round in the group of CPUs to report a QS for by the workqueue.

Quoted 8 lines
Fixes b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()")
Cc Uladzislau Rezki <[email protected]>
Cc Neeraj Upadhyay <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Joel Fernandes <[email protected]>

---

Thanks
Neeraj

Quoted 16 lines
  kernel/rcu/tree_exp.h | 1 +
  1 file changed, 1 insertion(+)
kernel/rcu/tree_exp.h +1 -0
index a96d17206d87..237a79989aba 100644
@@ -387,6 +387,7 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
  			continue;
  		}
  		if (get_cpu() == cpu) {
+			mask_ofl_test |= mask;
  			put_cpu();
  			continue;
  		}
maintainer Applied
#2 lore raw
Quoted 31 lines · Neeraj Upadhyay
Quoted 19 lines · Frederic Weisbecker

While looping through the rnp's CPUs to IPI for an expedited grace period, a first pass excludes the current CPU and the CPUs in dynticks idle mode. The workqueue will report their QS on their behalf later.

The second pass processes the IPIs and also ignores the current CPU, assuming it has been previously included in the group of CPUs whose QS are to be reported by the workqueue.

Unfortunately the current CPU may have changed between the first and second pass, due to the rnp lock being dropped, re-enabling preemption. As a result the current CPU, if different in the second pass, may be ignored by the expedited grace period. No IPI will be sent to it so it won't be requested to report an expedited quiescent state.

This ends up in an expedited grace period stall.

Fix this with including the current CPU in the second round in the group of CPUs to report a QS for by the workqueue.

Quoted 8 lines
Fixes b9ad4d6ed18e ("rcu: Avoid self-IPI in sync_rcu_exp_select_node_cpus()")
Cc Uladzislau Rezki <[email protected]>
Cc Neeraj Upadhyay <[email protected]>
Cc Boqun Feng <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Joel Fernandes <[email protected]>

---

Quoted 1 line

Applied, thank you both!

Thanx, Paul

Quoted 20 lines

Thanks
Neeraj

Quoted 16 lines
  kernel/rcu/tree_exp.h | 1 +
  1 file changed, 1 insertion(+)
kernel/rcu/tree_exp.h +1 -0
index a96d17206d87..237a79989aba 100644
@@ -387,6 +387,7 @@ static void sync_rcu_exp_select_node_cpus(struct work_struct *wp)
  			continue;
  		}
  		if (get_cpu() == cpu) {
+			mask_ofl_test |= mask;
  			put_cpu();
  			continue;
  		}