Sched_ext development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kuba Piecuch" <jpiecuch@google.com>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH RESEND v2 2/2] selftests/sched_ext: Test SCX_ENQ_CPU_SELECTED with queued wakeups
Date: Mon, 23 Nov 2026 17:33:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-229763@kernel.org> (raw)
In-Reply-To: <20261123171637.3859594-3-jpiecuch@google.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/sched_ext: pipe fd leak on error paths in spawn_pair()
- [Low] selftests/sched_ext: missing skeleton cleanup on load failure in
  setup()
--

commit 53693d287118813912c899a1ad2d7a5cd66987f6
Author: Kuba Piecuch <jpiecuch@google.com>

selftests/sched_ext: Test SCX_ENQ_CPU_SELECTED with queued wakeups

This commit adds a sched_ext selftest verifying that SCX_ENQ_CPU_SELECTED
is set on wakeup ops.enqueue() calls if and only if ops.select_cpu() ran
for that wakeup, including queued wakeups.

> diff --git a/tools/testing/selftests/sched_ext/enq_cpu_selected.c b/tools/testing/selftests/sched_ext/enq_cpu_selected.c
> new file mode 100644
> index 0000000000000..674c855530ed5
> --- /dev/null
> +++ b/tools/testing/selftests/sched_ext/enq_cpu_selected.c
> @@ -0,0 +1,194 @@

[ ... ]

> +static enum scx_test_status setup(void **ctx)
> +{
> +	struct enq_cpu_selected *skel;
> +
> +	nr_pairs = setup_masks();
> +	SCX_FAIL_IF(nr_pairs < 0, "Failed to get CPU affinity");
> +	if (!nr_pairs) {
> +		fprintf(stderr, "Needs at least %d CPUs, skipping\n",
> +			2 * CPUS_PER_TASK);
> +		return SCX_TEST_SKIP;
> +	}
> +
> +	skel = enq_cpu_selected__open();
> +	SCX_FAIL_IF(!skel, "Failed to open");
> +	SCX_ENUM_INIT(skel);
> +	SCX_FAIL_IF(enq_cpu_selected__load(skel), "Failed to load skel");

[Severity: Low]
Does this leak skel when enq_cpu_selected__load() fails?  run_test() skips
test->cleanup() whenever test->setup() does not return SCX_TEST_PASS, so
the opened skeleton stays allocated across subsequent tests in the runner
process.

[ ... ]

> +static int spawn_pair(pid_t *pids, const cpu_set_t *pair_masks)
> +{
> +	int a2b[2], b2a[2];
> +
> +	if (pipe(a2b) || pipe(b2a))
> +		return -errno;
> +
> +	pids[0] = fork();
> +	if (pids[0] < 0)
> +		return -errno;
> +	if (!pids[0])
> +		pingpong(b2a[0], a2b[1], true, &pair_masks[0]);
> +
> +	pids[1] = fork();
> +	if (pids[1] < 0)
> +		return -errno;

[Severity: Low]
Can these error paths leak the a2b and b2a pipe file descriptors?  If
pipe(b2a) fails, a2b[0..1] remain open, and if either fork() fails, all
four descriptors remain open in the multi-test runner process.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123171637.3859594-1-jpiecuch@google.com?part=2

      reply	other threads:[~2026-11-23 17:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 17:18 [PATCH RESEND v2 0/2] sched: Fix SCX_ENQ_CPU_SELECTED for queued wakeups Kuba Piecuch
2026-11-23 17:18 ` [PATCH RESEND v2 1/2] sched/core: Preserve WF_RQ_SELECTED across " Kuba Piecuch
2026-11-23 17:18 ` [PATCH RESEND v2 2/2] selftests/sched_ext: Test SCX_ENQ_CPU_SELECTED with " Kuba Piecuch
2026-11-23 17:33   ` 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-229763@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jpiecuch@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox