Skip to contentSkip to conversation

rcu-tasks: Idle tasks on offline CPUs are in quiescent states

PATCH In review Krister Johansen 2 participants 5 messages Nov 22, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover rcu-tasks: Idle tasks on offline CPUs are in quiescent states

Paul, Neeraj, and Stable Team:
I've run into a case with rcu_tasks_postscan where the warning introduced as part of 46aa886c4("rcu-tasks: Fix IPI failure handling in trc_wait_for_one_reader") is getting triggered when trc_wait_for_one_reader sends an IPI to a CPU that is offline. This is occurring on a platform that has hotplug slots available but not populated. I don't believe the bug is caused by this change, but I do think that Paul's commit that confines the postscan operation to just the active CPUs would help prevent this from happening.

Would the RCU maintainers be amenable to having this patch backported to the 5.10 and 5.15 branches as well? I've attached cherry-picks of the relevant commits to minimize the additional work needed.

Thanks,

-K

Paul E. McKenney (1):
rcu-tasks: Idle tasks on offline CPUs are in quiescent states

 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 rcu-tasks: Idle tasks on offline CPUs are in quiescent states

From: Paul E. McKenney <[email protected]>

commit 5c9a9ca44fda41c5e82f50efced5297a9c19760d upstream

Any idle task corresponding to an offline CPU is in an RCU Tasks Trace quiescent state. This commit causes rcu_tasks_trace_postscan() to ignore idle tasks for offline CPUs, which it can do safely due to CPU-hotplug operations being disabled.

Cc Neeraj Upadhyay <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Martin KaFai Lau <[email protected]>
Cc KP Singh <[email protected]>
---
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tasks.h +1 -1
index 5528c172570b..8648685e7dfa 100644
@@ -1090,7 +1090,7 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
 {
 	int cpu;
 
-	for_each_possible_cpu(cpu)
+	for_each_online_cpu(cpu)
 		rcu_tasks_trace_pertask(idle_task(cpu), hop);
 
 	// Re-enable CPU hotplug now that the tasklist scan has completed.
Signature · 1 line
2.25.1
maintainer
#2 lore raw

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 5c9a9ca44fda41c5e82f50efced5297a9c19760d

WARNING: Author mismatch between patch and upstream commit:
Backport author: Krister Johansen <[email protected]> Commit author: Paul E. McKenney <[email protected]>

Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.11.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Not found

Note: The patch differs from the upstream commit:
---

tmp/tmp.xl2TPMYb3p renamed from - +8 -2
@@ -1,3 +1,5 @@
+commit 5c9a9ca44fda41c5e82f50efced5297a9c19760d upstream
+
 Any idle task corresponding to an offline CPU is in an RCU Tasks Trace
 quiescent state.  This commit causes rcu_tasks_trace_postscan() to ignore
 idle tasks for offline CPUs, which it can do safely due to CPU-hotplug
@@ -10,15 +12,16 @@
 Cc: Andrii Nakryiko <[email protected]>
 Cc: Martin KaFai Lau <[email protected]>
 Cc: KP Singh <[email protected]>
+Signed-off-by: Krister Johansen <[email protected]>
 ---
  kernel/rcu/tasks.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
-index 8fe78a7fecafd..ec68bfe98c958 100644
+index 5528c172570b..8648685e7dfa 100644
 --- a/kernel/rcu/tasks.h
 +++ b/kernel/rcu/tasks.h
-@@ -1451,7 +1451,7 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
+@@ -1090,7 +1090,7 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
  {
  	int cpu;
  
@@ -27,3 +30,6 @@
  		rcu_tasks_trace_pertask(idle_task(cpu), hop);
  
  	// Re-enable CPU hotplug now that the tasklist scan has completed.
+-- 
+2.25.1
+

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y       |  Success    |  Success   |
#3 lore raw

PATCH 2/2 rcu-tasks: Idle tasks on offline CPUs are in quiescent states

In reply to Krister Johansen

From: Paul E. McKenney <[email protected]>

commit 5c9a9ca44fda41c5e82f50efced5297a9c19760d upstream

Any idle task corresponding to an offline CPU is in an RCU Tasks Trace quiescent state. This commit causes rcu_tasks_trace_postscan() to ignore idle tasks for offline CPUs, which it can do safely due to CPU-hotplug operations being disabled.

Cc Neeraj Upadhyay <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Alexei Starovoitov <[email protected]>
Cc Andrii Nakryiko <[email protected]>
Cc Martin KaFai Lau <[email protected]>
Cc KP Singh <[email protected]>
---
 kernel/rcu/tasks.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tasks.h +1 -1
index bede3a4f108e..ea45a2d53a99 100644
@@ -1007,7 +1007,7 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
 {
 	int cpu;
 
-	for_each_possible_cpu(cpu)
+	for_each_online_cpu(cpu)
 		rcu_tasks_trace_pertask(idle_task(cpu), hop);
 
 	// Re-enable CPU hotplug now that the tasklist scan has completed.
Signature · 1 line
2.25.1
maintainer
#4 lore raw

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 5c9a9ca44fda41c5e82f50efced5297a9c19760d

WARNING: Author mismatch between patch and upstream commit:
Backport author: Krister Johansen <[email protected]> Commit author: Paul E. McKenney <[email protected]>

Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.11.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Not found
5.10.y | Not found

Note: The patch differs from the upstream commit:
---

tmp/tmp.eKXYnEofof renamed from - +8 -2
@@ -1,3 +1,5 @@
+commit 5c9a9ca44fda41c5e82f50efced5297a9c19760d upstream
+
 Any idle task corresponding to an offline CPU is in an RCU Tasks Trace
 quiescent state.  This commit causes rcu_tasks_trace_postscan() to ignore
 idle tasks for offline CPUs, which it can do safely due to CPU-hotplug
@@ -10,15 +12,16 @@
 Cc: Andrii Nakryiko <[email protected]>
 Cc: Martin KaFai Lau <[email protected]>
 Cc: KP Singh <[email protected]>
+Signed-off-by: Krister Johansen <[email protected]>
 ---
  kernel/rcu/tasks.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
-index 8fe78a7fecafd..ec68bfe98c958 100644
+index bede3a4f108e..ea45a2d53a99 100644
 --- a/kernel/rcu/tasks.h
 +++ b/kernel/rcu/tasks.h
-@@ -1451,7 +1451,7 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
+@@ -1007,7 +1007,7 @@ static void rcu_tasks_trace_postscan(struct list_head *hop)
  {
  	int cpu;
  
@@ -27,3 +30,6 @@
  		rcu_tasks_trace_pertask(idle_task(cpu), hop);
  
  	// Re-enable CPU hotplug now that the tasklist scan has completed.
+-- 
+2.25.1
+

---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.10.y       |  Failed     |  N/A       |