From: Tejun Heo <tj@kernel.org>
To: Ihor Solodrai <ihor.solodrai@pm.me>
Cc: David Vernet <void@manifault.com>,
sched-ext@meta.com, kernel-team@meta.com,
linux-kernel@vger.kernel.org, bpf <bpf@vger.kernel.org>
Subject: [PATCH sched_ext/for-6.13-fixes] sched_ext: Fix dsq_local_on selftest
Date: Tue, 24 Dec 2024 14:09:15 -1000 [thread overview]
Message-ID: <Z2tNK2oFDX1OPp8C@slm.duckdns.org> (raw)
In-Reply-To: <ouIylyHgXTVZ9RiyVeHZ26YXQLKMEKHoOVPWIgpWRDD2FL2RDwwUEocaj4LMpMR3PjbwpPuxEnJAjMeD4e7LnWIAYvIbGC5BPvPGtzyumYk=@pm.me>
The dsp_local_on selftest expects the scheduler to fail by trying to
schedule an e.g. CPU-affine task to the wrong CPU. However, this isn't
guaranteed to happen in the 1 second window that the test is running.
Besides, it's odd to have this particular exception path tested when there
are no other tests that verify that the interface is working at all - e.g.
the test would pass if dsp_local_on interface is completely broken and fails
on any attempt.
Flip the test so that it verifies that the feature works. While at it, fix a
typo in the info message.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ihor Solodrai <ihor.solodrai@pm.me>
Link: http://lkml.kernel.org/r/Z1n9v7Z6iNJ-wKmq@slm.duckdns.org
---
tools/testing/selftests/sched_ext/dsp_local_on.bpf.c | 5 ++++-
tools/testing/selftests/sched_ext/dsp_local_on.c | 5 +++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c b/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c
index 6325bf76f47e..fbda6bf54671 100644
--- a/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c
+++ b/tools/testing/selftests/sched_ext/dsp_local_on.bpf.c
@@ -43,7 +43,10 @@ void BPF_STRUCT_OPS(dsp_local_on_dispatch, s32 cpu, struct task_struct *prev)
if (!p)
return;
- target = bpf_get_prandom_u32() % nr_cpus;
+ if (p->nr_cpus_allowed == nr_cpus)
+ target = bpf_get_prandom_u32() % nr_cpus;
+ else
+ target = scx_bpf_task_cpu(p);
scx_bpf_dsq_insert(p, SCX_DSQ_LOCAL_ON | target, SCX_SLICE_DFL, 0);
bpf_task_release(p);
diff --git a/tools/testing/selftests/sched_ext/dsp_local_on.c b/tools/testing/selftests/sched_ext/dsp_local_on.c
index 472851b56854..0ff27e57fe43 100644
--- a/tools/testing/selftests/sched_ext/dsp_local_on.c
+++ b/tools/testing/selftests/sched_ext/dsp_local_on.c
@@ -34,9 +34,10 @@ static enum scx_test_status run(void *ctx)
/* Just sleeping is fine, plenty of scheduling events happening */
sleep(1);
- SCX_EQ(skel->data->uei.kind, EXIT_KIND(SCX_EXIT_ERROR));
bpf_link__destroy(link);
+ SCX_EQ(skel->data->uei.kind, EXIT_KIND(SCX_EXIT_UNREG));
+
return SCX_TEST_PASS;
}
@@ -50,7 +51,7 @@ static void cleanup(void *ctx)
struct scx_test dsp_local_on = {
.name = "dsp_local_on",
.description = "Verify we can directly dispatch tasks to a local DSQs "
- "from osp.dispatch()",
+ "from ops.dispatch()",
.setup = setup,
.run = run,
.cleanup = cleanup,
next prev parent reply other threads:[~2024-12-25 0:09 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 15:29 [PATCH] scx: Fix maximal BPF selftest prog David Vernet
2024-12-10 14:37 ` Andrea Righi
2024-12-10 20:52 ` Ihor Solodrai
2024-12-11 21:01 ` [PATCH sched_ext/for-6.13-fixes] sched_ext: Fix invalid irq restore in scx_ops_bypass() Tejun Heo
2024-12-11 21:03 ` Tejun Heo
2024-12-12 18:12 ` Ihor Solodrai
2024-12-17 23:44 ` Ihor Solodrai
2024-12-18 18:34 ` Tejun Heo
2024-12-19 22:51 ` Ihor Solodrai
2024-12-20 19:26 ` Ihor Solodrai
2024-12-25 0:09 ` Tejun Heo [this message]
2024-12-25 0:10 ` [PATCH sched_ext/for-6.13-fixes] sched_ext: Fix dsq_local_on selftest Tejun Heo
2025-01-15 23:50 ` Ihor Solodrai
2025-01-22 1:40 ` Tejun Heo
2025-01-22 19:10 ` Ihor Solodrai
2025-01-23 9:40 ` Andrea Righi
2025-01-23 16:57 ` Tejun Heo
2025-01-23 18:45 ` Andrea Righi
2025-01-23 22:26 ` Andrea Righi
2025-01-24 22:00 ` [PATCH sched_ext/for-6.14-fixes] sched_ext: selftests/dsp_local_on: Fix sporadic failures Tejun Heo
2025-01-25 4:54 ` Andrea Righi
2025-01-27 18:45 ` Tejun Heo
2024-12-11 6:31 ` [PATCH] scx: Fix maximal BPF selftest prog Tejun Heo
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=Z2tNK2oFDX1OPp8C@slm.duckdns.org \
--to=tj@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=ihor.solodrai@pm.me \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@meta.com \
--cc=void@manifault.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