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(-)
From: Paul E. McKenney paulmck@kernel.org
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.
Signed-off-by: Paul E. McKenney paulmck@kernel.org Cc: Neeraj Upadhyay quic_neeraju@quicinc.com Cc: Eric Dumazet edumazet@google.com Cc: Alexei Starovoitov ast@kernel.org Cc: Andrii Nakryiko andrii@kernel.org Cc: Martin KaFai Lau kafai@fb.com Cc: KP Singh kpsingh@kernel.org Signed-off-by: Krister Johansen kjlx@templeofstupid.com --- 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 5528c172570b..8648685e7dfa 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -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.
[ 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 kjlx@templeofstupid.com Commit author: Paul E. McKenney paulmck@kernel.org
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: --- --- - 2024-11-22 08:20:56.541099344 -0500 +++ /tmp/tmp.xl2TPMYb3p 2024-11-22 08:20:56.533807007 -0500 @@ -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 andrii@kernel.org Cc: Martin KaFai Lau kafai@fb.com Cc: KP Singh kpsingh@kernel.org +Signed-off-by: Krister Johansen kjlx@templeofstupid.com --- 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 |
From: Paul E. McKenney paulmck@kernel.org
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.
Signed-off-by: Paul E. McKenney paulmck@kernel.org Cc: Neeraj Upadhyay quic_neeraju@quicinc.com Cc: Eric Dumazet edumazet@google.com Cc: Alexei Starovoitov ast@kernel.org Cc: Andrii Nakryiko andrii@kernel.org Cc: Martin KaFai Lau kafai@fb.com Cc: KP Singh kpsingh@kernel.org Signed-off-by: Krister Johansen kjlx@templeofstupid.com --- 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 bede3a4f108e..ea45a2d53a99 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -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.
[ 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 kjlx@templeofstupid.com Commit author: Paul E. McKenney paulmck@kernel.org
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: --- --- - 2024-11-22 08:26:15.770984330 -0500 +++ /tmp/tmp.eKXYnEofof 2024-11-22 08:26:15.765204063 -0500 @@ -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 andrii@kernel.org Cc: Martin KaFai Lau kafai@fb.com Cc: KP Singh kpsingh@kernel.org +Signed-off-by: Krister Johansen kjlx@templeofstupid.com --- 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 |
linux-stable-mirror@lists.linaro.org