public inbox for sched-ext@lists.linux.dev
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Cheng-Yang Chou <yphbchou0911@gmail.com>
Cc: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Christian Loehle <christian.loehle@arm.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org,
	Ching-Chun Huang <jserv@ccns.ncku.edu.tw>,
	Chia-Ping Tsai <chia7712@gmail.com>
Subject: Re: [PATCH 2/2] selftests/sched_ext: Add cyclic SCX_KICK_WAIT stress test
Date: Sun, 29 Mar 2026 17:52:12 +0200	[thread overview]
Message-ID: <aclKrNMA4CG7K5K9@gpd4> (raw)
In-Reply-To: <r36q4trzw267surx5xbod3ilm4wgmmyurqk6kres6gmtj7qbfl@lyasdc3a2zlk>

Hi Cheng-Yang,

On Sun, Mar 29, 2026 at 05:06:20PM +0800, Cheng-Yang Chou wrote:
> Hi Tejun,
> 
> On Sat, Mar 28, 2026 at 02:18:56PM -1000, Tejun Heo wrote:
> > Add a test that creates a 3-CPU kick_wait cycle (A->B->C->A). A BPF
> > scheduler kicks the next CPU in the ring with SCX_KICK_WAIT on every
> > enqueue while userspace workers generate continuous scheduling churn via
> > sched_yield(). Without the preceding fix, this hangs the machine within seconds.
> 
> I think it would be better to skip this test on older, unpatched kernels.
> Sometimes I use my local kernel for testing before the stable patches are
> fully integrated, so skipping the test would be a safer approach.
> 
> Otherwise, this test can stall the machine and make it impossible to
> exit the test runner.

Actually, I disagree. The whole point of the kselftests is to expose kernel
issues, including bugs in older kernels that may need fixes. So, I think we
shouldn't skip the test.

-Andrea

> 
> Log:
> 
> $ sudo ./runner -t cyclic_kick_wait # on v6.14
> ===== START =====
> TEST: cyclic_kick_wait
> DESCRIPTION: Verify SCX_KICK_WAIT forward progress under a 3-CPU wait cycle
> OUTPUT:
> libbpf: struct_ops cyclic_kick_wait_ops: member cgroup_set_bandwidth not found in kernel, skipping it as it's set to zero
> libbpf: struct_ops cyclic_kick_wait_ops: member cgroup_set_idle not found in kernel, skipping it as it's set to zero
> libbpf: struct_ops cyclic_kick_wait_ops: member priv not found in kernel, skipping it as it's set to zero
> ERR: cyclic_kick_wait.c:169
> Failed to join worker thread 0 (-110)
> 
> Thanks,
> Cheng-Yang
> 

> From 6f09d2298e547aa7a519d4bff262fc6851a969ea Mon Sep 17 00:00:00 2001
> From: Cheng-Yang Chou <yphbchou0911@gmail.com>
> Date: Sun, 29 Mar 2026 16:07:05 +0800
> Subject: [PATCH] selftests/sched_ext: Skip cyclic_kick_wait on kernels without
>  deadlock fix
> 
> The cyclic_kick_wait test triggers a deadlock on kernels lacking the
> SCX_KICK_WAIT fix, causing the machine to hang or worker threads to
> timeout (-110).
> 
> Use __COMPAT_struct_has_field() to probe vmlinux BTF for
> rq_scx.kick_sync_pending, a field introduced by the SCX_KICK_WAIT
> deadlock fix. Skip the test on older kernels that lack the fix rather
> than hanging the machine.
> 
> Example failure on unpatched kernels:
>   ERR: cyclic_kick_wait.c:169
>   Failed to join worker thread 0 (-110)
> 
> Fixes: e9b990b76922 ("selftests/sched_ext: Add cyclic SCX_KICK_WAIT stress test")
> Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
> ---
>  tools/testing/selftests/sched_ext/cyclic_kick_wait.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/testing/selftests/sched_ext/cyclic_kick_wait.c b/tools/testing/selftests/sched_ext/cyclic_kick_wait.c
> index c2e5aa9de715..b060ffe63ba3 100644
> --- a/tools/testing/selftests/sched_ext/cyclic_kick_wait.c
> +++ b/tools/testing/selftests/sched_ext/cyclic_kick_wait.c
> @@ -88,6 +88,11 @@ static enum scx_test_status setup(void **ctx)
>  {
>  	struct cyclic_kick_wait *skel;
>  
> +	if (!__COMPAT_struct_has_field("rq_scx", "kick_sync_pending")) {
> +		fprintf(stderr, "Skipping test: kernel lacks SCX_KICK_WAIT deadlock fix\n");
> +		return SCX_TEST_SKIP;
> +	}
> +
>  	skel = cyclic_kick_wait__open();
>  	SCX_FAIL_IF(!skel, "Failed to open skel");
>  	SCX_ENUM_INIT(skel);
> -- 
> 2.43.0
> 


      reply	other threads:[~2026-03-29 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29  0:18 [PATCHSET sched_ext/for-7.0-fixes] sched_ext: Fix SCX_KICK_WAIT deadlock Tejun Heo
2026-03-29  0:18 ` [PATCH 1/2] sched_ext: Fix SCX_KICK_WAIT deadlock by deferring wait to balance callback Tejun Heo
2026-03-29 16:26   ` Andrea Righi
2026-03-29  0:18 ` [PATCH 2/2] selftests/sched_ext: Add cyclic SCX_KICK_WAIT stress test Tejun Heo
2026-03-29  9:06   ` Cheng-Yang Chou
2026-03-29 15:52     ` Andrea Righi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aclKrNMA4CG7K5K9@gpd4 \
    --to=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=chia7712@gmail.com \
    --cc=christian.loehle@arm.com \
    --cc=emil@etsalapatis.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    --cc=yphbchou0911@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox