The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] selftests/sched_ext: Fix exit selftest hang on UP
@ 2025-07-01  6:08 Andrea Righi
  2025-07-01 13:00 ` Phil Auld
  2025-07-03 16:45 ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Andrea Righi @ 2025-07-01  6:08 UTC (permalink / raw)
  To: Tejun Heo, David Vernet, Changwoo Min; +Cc: Phil Auld, linux-kernel

On single-CPU systems, ops.select_cpu() is never called, causing the
EXIT_SELECT_CPU test case to wait indefinitely.

Avoid the stall by skipping this specific sub-test when only one CPU is
available.

Reported-by: Phil Auld <pauld@redhat.com>
Fixes: a5db7817af780 ("sched_ext: Add selftests")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
 tools/testing/selftests/sched_ext/exit.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/sched_ext/exit.c b/tools/testing/selftests/sched_ext/exit.c
index 9451782689de1..ee25824b1cbe6 100644
--- a/tools/testing/selftests/sched_ext/exit.c
+++ b/tools/testing/selftests/sched_ext/exit.c
@@ -22,6 +22,14 @@ static enum scx_test_status run(void *ctx)
 		struct bpf_link *link;
 		char buf[16];
 
+		/*
+		 * On single-CPU systems, ops.select_cpu() is never
+		 * invoked, so skip this test to avoid getting stuck
+		 * indefinitely.
+		 */
+		if (tc == EXIT_SELECT_CPU && libbpf_num_possible_cpus() == 1)
+			continue;
+
 		skel = exit__open();
 		SCX_ENUM_INIT(skel);
 		skel->rodata->exit_point = tc;
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/sched_ext: Fix exit selftest hang on UP
  2025-07-01  6:08 [PATCH] selftests/sched_ext: Fix exit selftest hang on UP Andrea Righi
@ 2025-07-01 13:00 ` Phil Auld
  2025-07-03 16:45 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Phil Auld @ 2025-07-01 13:00 UTC (permalink / raw)
  To: Andrea Righi; +Cc: Tejun Heo, David Vernet, Changwoo Min, linux-kernel

On Tue, Jul 01, 2025 at 08:08:45AM +0200 Andrea Righi wrote:
> On single-CPU systems, ops.select_cpu() is never called, causing the
> EXIT_SELECT_CPU test case to wait indefinitely.
> 
> Avoid the stall by skipping this specific sub-test when only one CPU is
> available.
> 
> Reported-by: Phil Auld <pauld@redhat.com>
> Fixes: a5db7817af780 ("sched_ext: Add selftests")
> Signed-off-by: Andrea Righi <arighi@nvidia.com>


Thanks Andrea! You beat me to it. I didn't know that libbpf
call existed :)

Reviewed-by: Phil Auld <pauld@redhat.com>

and

Tested-by: Phil Auld <pauld@redhat.com>


Cheers,
Phil

> ---
>  tools/testing/selftests/sched_ext/exit.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/testing/selftests/sched_ext/exit.c b/tools/testing/selftests/sched_ext/exit.c
> index 9451782689de1..ee25824b1cbe6 100644
> --- a/tools/testing/selftests/sched_ext/exit.c
> +++ b/tools/testing/selftests/sched_ext/exit.c
> @@ -22,6 +22,14 @@ static enum scx_test_status run(void *ctx)
>  		struct bpf_link *link;
>  		char buf[16];
>  
> +		/*
> +		 * On single-CPU systems, ops.select_cpu() is never
> +		 * invoked, so skip this test to avoid getting stuck
> +		 * indefinitely.
> +		 */
> +		if (tc == EXIT_SELECT_CPU && libbpf_num_possible_cpus() == 1)
> +			continue;
> +
>  		skel = exit__open();
>  		SCX_ENUM_INIT(skel);
>  		skel->rodata->exit_point = tc;
> -- 
> 2.50.0
> 

-- 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/sched_ext: Fix exit selftest hang on UP
  2025-07-01  6:08 [PATCH] selftests/sched_ext: Fix exit selftest hang on UP Andrea Righi
  2025-07-01 13:00 ` Phil Auld
@ 2025-07-03 16:45 ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2025-07-03 16:45 UTC (permalink / raw)
  To: Andrea Righi; +Cc: David Vernet, Changwoo Min, Phil Auld, linux-kernel

On Tue, Jul 01, 2025 at 08:08:45AM +0200, Andrea Righi wrote:
> On single-CPU systems, ops.select_cpu() is never called, causing the
> EXIT_SELECT_CPU test case to wait indefinitely.
> 
> Avoid the stall by skipping this specific sub-test when only one CPU is
> available.
> 
> Reported-by: Phil Auld <pauld@redhat.com>
> Fixes: a5db7817af780 ("sched_ext: Add selftests")
> Signed-off-by: Andrea Righi <arighi@nvidia.com>

Applied to sched_ext/for-6.16-fixes.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-03 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01  6:08 [PATCH] selftests/sched_ext: Fix exit selftest hang on UP Andrea Righi
2025-07-01 13:00 ` Phil Auld
2025-07-03 16:45 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox