From: sashiko-bot@kernel.org
To: "Changwoo Min" <changwoo@igalia.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH v3 6/6] selftests/sched_ext: Test task field reset across sub-scheduler handoffs
Date: Sun, 06 Dec 2026 06:06:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-252206@kernel.org> (raw)
In-Reply-To: <20261206053728.2026272-7-changwoo@igalia.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/sched_ext: SCX_EQ() double-evaluates calls in
handoffs()
- [Low] selftests/sched_ext: sub_handoff.c duplicates helpers from
sibling tests
--
commit 20ecdae3e4d6197a4eacc5c0de5f09501133284c
Author: Changwoo Min <changwoo@igalia.com>
selftests/sched_ext: Test task field reset across sub-scheduler handoffs
This commit adds the sub_handoff sched_ext selftest, which loads a cid-form
scheduler as both root and sub-scheduler to verify that p->scx.bpf_priv and
dsq_vtime are cleared across handoffs and that ops.init_task() observes the
previous owner.
> diff --git a/tools/testing/selftests/sched_ext/sub_handoff.c b/tools/testing/selftests/sched_ext/sub_handoff.c
> new file mode 100644
> index 0000000000000..e79eea4c95424
> --- /dev/null
> +++ b/tools/testing/selftests/sched_ext/sub_handoff.c
> @@ -0,0 +1,341 @@
[ ... ]
> +static u64 get_cgroup_id(const char *path)
> +{
> + union {
> + u64 id;
> + unsigned char bytes[8];
> + } id = {};
> + struct file_handle *handle;
> + int mount_id, ret;
> +
> + handle = calloc(1, sizeof(*handle) + sizeof(id));
> + if (!handle)
> + return 0;
> + handle->handle_bytes = sizeof(id);
> + ret = name_to_handle_at(AT_FDCWD, path, handle, &mount_id, 0);
> + if (!ret && handle->handle_bytes == sizeof(id))
> + memcpy(id.bytes, handle->f_handle, sizeof(id));
> + free(handle);
> +
> + return ret ? 0 : id.id;
> +}
> +
> +static u64 now_ns(void)
> +{
> + struct timespec ts;
> +
> + clock_gettime(CLOCK_MONOTONIC, &ts);
> + return (u64)ts.tv_sec * 1000000000ULL + ts.tv_nsec;
> +}
[ ... ]
> +static bool wait_pid_sleeping(pid_t pid, u64 timeout_ms)
[ ... ]
[Severity: Low]
Could get_cgroup_id(), now_ns(), and wait_pid_sleeping() be shared in
util.c and util.h instead of duplicated here?
All three already exist in tools/testing/selftests/sched_ext/sub_core_caps.c,
and cgroup_nr_cpus.c has another copy of get_cgroup_id() as cgroup_id().
The sched_ext selftest Makefile already links util.o into the runner binary.
[ ... ]
> + SCX_EQ(sched_setscheduler(pid, SCHED_EXT, ¶m), 0);
> + SCX_EQ(wait_u64(&root->nr_enable, 1), 1);
[ ... ]
> + SCX_EQ(wait_u64(&sub->nr_enable, 1), 1);
[ ... ]
> + SCX_EQ(wait_u64(&root->nr_enable, 2), 2);
[Severity: Low]
Can SCX_EQ() evaluate wait_u64() and sched_setscheduler() twice on failure?
SCX_EQ() expands _x in both the comparison and the failure message:
tools/testing/selftests/sched_ext/scx_test.h:
#define SCX_EQ(_x, _y) SCX_FAIL_IF((_x) != (_y), "Expected %s == %s (%lu == %lu)", \
#_x, #_y, (u64)(_x), (u64)(_y))
If wait_u64() times out after 30 seconds, the second evaluation blocks for
another 30 seconds and can print a contradictory actual value if the counter
updates in the meantime. On failure, sched_setscheduler() is also called a
second time.
Storing each return value in a local variable before passing it to SCX_EQ()
avoids the duplicate calls.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261206053728.2026272-1-changwoo@igalia.com?part=6
prev parent reply other threads:[~2026-12-06 6:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-06 5:37 [PATCH v3 0/6] sched_ext: Add p->scx.bpf_priv for O(1) task context lookup Changwoo Min
2026-12-06 5:37 ` [PATCH v3 1/6] sched_ext: Add scx_bpf_sched_id() and scx_task_sched_id() Changwoo Min
2026-12-06 6:03 ` sashiko-bot
2026-12-06 5:37 ` [PATCH v3 2/6] selftests/sched_ext: Test " Changwoo Min
2026-12-06 5:37 ` [PATCH v3 3/6] sched_ext: Add p->scx.bpf_priv for O(1) task context lookup Changwoo Min
2026-12-06 6:00 ` sashiko-bot
2026-12-06 5:37 ` [PATCH v3 4/6] sched_ext: scx_qmap: Cache task_ctx in p->scx.bpf_priv Changwoo Min
2026-12-06 5:56 ` sashiko-bot
2026-12-06 5:37 ` [PATCH v3 5/6] selftests/sched_ext: Test p->scx.bpf_priv across class changes Changwoo Min
2026-12-06 5:59 ` sashiko-bot
2026-12-06 5:37 ` [PATCH v3 6/6] selftests/sched_ext: Test task field reset across sub-scheduler handoffs Changwoo Min
2026-12-06 6:06 ` sashiko-bot [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=sashiko-outbox-252206@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=changwoo@igalia.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.