Skip to contentSkip to conversation

rcu/nocb: Dump gp state even if rdp gp itself is not offloaded

PATCH In review Frederic Weisbecker 2 participants 2 messages Mar 18, 2025 RCU

lore
Share & tools
lore

Frederic Weisbecker

author maintainer
#0 lore raw

PATCH 1/1 rcu/nocb: Dump gp state even if rdp gp itself is not offloaded

When a stall is detected, the state of each NOCB CPU is dumped along with the state of each NOCB group. The latter part however is incidentally ignored if the NOCB group leader happens not to be offloaded itself.

Fix this to make sure related precious informations aren't lost over a stall report.

---
 kernel/rcu/tree_nocb.h  | 3 +++
 kernel/rcu/tree_stall.h | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)
kernel/rcu/tree_nocb.h +3 -0
index 4a954ecf1c36..56baa78c6e85 100644
@@ -1564,6 +1564,9 @@ static void show_rcu_nocb_state(struct rcu_data *rdp)
 	if (rdp->nocb_gp_rdp == rdp)
 		show_rcu_nocb_gp_state(rdp);
 
+	if (!rcu_segcblist_is_offloaded(&rdp->cblist))
+		return;
+
 	nocb_next_rdp = list_next_or_null_rcu(&rdp->nocb_gp_rdp->nocb_head_rdp,
 					      &rdp->nocb_entry_rdp,
 					      typeof(*rdp),
kernel/rcu/tree_stall.h +1 -2
index 56b21219442b..f96235d51642 100644
@@ -927,8 +927,7 @@ void show_rcu_gp_kthreads(void)
 	for_each_possible_cpu(cpu) {
 		rdp = per_cpu_ptr(&rcu_data, cpu);
 		cbs += data_race(READ_ONCE(rdp->n_cbs_invoked));
-		if (rcu_segcblist_is_offloaded(&rdp->cblist))
-			show_rcu_nocb_state(rdp);
+		show_rcu_nocb_state(rdp);
 	}
 	pr_info("RCU callbacks invoked since boot: %lu\n", cbs);
 	show_rcu_tasks_gp_kthreads();
Signature · 1 line
2.48.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Frederic Weisbecker

When a stall is detected, the state of each NOCB CPU is dumped along with the state of each NOCB group. The latter part however is incidentally ignored if the NOCB group leader happens not to be offloaded itself.

Fix this to make sure related precious informations aren't lost over a stall report.

Much better, thank you!

Quoted 36 lines
---
 kernel/rcu/tree_nocb.h  | 3 +++
 kernel/rcu/tree_stall.h | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)
kernel/rcu/tree_nocb.h +3 -0
index 4a954ecf1c36..56baa78c6e85 100644
@@ -1564,6 +1564,9 @@ static void show_rcu_nocb_state(struct rcu_data *rdp)
 	if (rdp->nocb_gp_rdp == rdp)
 		show_rcu_nocb_gp_state(rdp);
 
+	if (!rcu_segcblist_is_offloaded(&rdp->cblist))
+		return;
+
 	nocb_next_rdp = list_next_or_null_rcu(&rdp->nocb_gp_rdp->nocb_head_rdp,
 					      &rdp->nocb_entry_rdp,
 					      typeof(*rdp),
kernel/rcu/tree_stall.h +1 -2
index 56b21219442b..f96235d51642 100644
@@ -927,8 +927,7 @@ void show_rcu_gp_kthreads(void)
 	for_each_possible_cpu(cpu) {
 		rdp = per_cpu_ptr(&rcu_data, cpu);
 		cbs += data_race(READ_ONCE(rdp->n_cbs_invoked));
-		if (rcu_segcblist_is_offloaded(&rdp->cblist))
-			show_rcu_nocb_state(rdp);
+		show_rcu_nocb_state(rdp);
 	}
 	pr_info("RCU callbacks invoked since boot: %lu\n", cbs);
 	show_rcu_tasks_gp_kthreads();
Signature · 1 line
2.48.1