From: Christian Loehle <christian.loehle@arm.com>
To: Juri Lelli <juri.lelli@redhat.com>, Shuah Khan <shuah@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Valentin Schneider <vschneid@redhat.com>,
Clark Williams <williams@redhat.com>,
Gabriele Monaco <gmonaco@redhat.com>,
Tommaso Cucinotta <tommaso.cucinotta@santannapisa.it>,
Luca Abeni <luca.abeni@santannapisa.it>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH RFC 2/7] selftests/sched: Add SCHED_DEADLINE utility library
Date: Wed, 11 Mar 2026 09:39:37 +0000 [thread overview]
Message-ID: <2d14e8b7-a7c3-46ba-b1d2-6bb6404c08fa@arm.com> (raw)
In-Reply-To: <20260306-upstream-deadline-kselftests-v1-2-2b23ef74c46a@redhat.com>
On 3/6/26 16:10, Juri Lelli wrote:
> Add a comprehensive utility library for SCHED_DEADLINE scheduler tests.
> This library provides reusable helper functions that simplify test
> implementation and reduce code duplication across the test suite.
>
> The utility library provides scheduling operations that wrap the
> sched_setattr and sched_getattr syscalls for setting and querying
> SCHED_DEADLINE parameters. These include dl_set_sched_attr() for
> configuring deadline parameters, dl_get_sched_attr() for querying
> scheduling attributes, dl_get_policy() for reading the policy from
> /proc, and dl_is_deadline_task() for checking if a task is using
> SCHED_DEADLINE. The library uses system headers for struct sched_attr
> to avoid redefinition conflicts and provides full control over
> SCHED_DEADLINE parameters.
>
> Bandwidth management helpers allow tests to work within system
> constraints. The dl_get_rt_bandwidth() function reads RT bandwidth
> settings from /proc, while dl_calc_max_bandwidth_percent() calculates
> the available bandwidth for deadline tasks based on current system
> configuration.
>
> Process management functions simplify creating and managing test
> workloads. The dl_create_cpuhog() function forks and schedules a cpuhog
> process by creating a child process, executing the cpuhog binary, and
> setting SCHED_DEADLINE policy on the child PID after fork. It waits for
> the child to start before configuring the scheduling policy. Supporting
> functions include dl_cleanup_cpuhog() for terminating processes,
> dl_find_cpuhogs() for locating running instances, and dl_wait_for_pid()
> for synchronizing with process startup.
>
> CPU topology helpers enable tests that manipulate CPU hotplug state.
> These include dl_get_online_cpus() for counting available CPUs,
> dl_get_hotpluggable_cpus() for identifying which CPUs can be
> hotplugged, dl_cpu_online() and dl_cpu_offline() for controlling
> hotplug state, and dl_is_cpu_online() for checking current status.
>
> Time conversion utilities provide convenient transformations between
> different time units. These include dl_ms_to_ns() and dl_us_to_ns()
> for converting to nanoseconds, and dl_ns_to_ms() and dl_ns_to_us() for
> converting from nanoseconds.
>
> The library also includes the cpuhog helper program, which performs
> busy looping to consume CPU cycles. This provides a controllable
> workload for testing scheduler behavior under various deadline
> configurations.
>
> Assisted-by: Claude Code: claude-sonnet-4-5@20250929
> Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
> ---
> tools/testing/selftests/sched/deadline/Makefile | 14 +-
> tools/testing/selftests/sched/deadline/cpuhog.c | 107 ++++++++
> tools/testing/selftests/sched/deadline/dl_util.c | 335 +++++++++++++++++++++++
> tools/testing/selftests/sched/deadline/dl_util.h | 227 +++++++++++++++
> 4 files changed, 680 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/sched/deadline/Makefile b/tools/testing/selftests/sched/deadline/Makefile
> index fd57794f1a543..ea3fdfbef459e 100644
> --- a/tools/testing/selftests/sched/deadline/Makefile
> +++ b/tools/testing/selftests/sched/deadline/Makefile
> @@ -1,6 +1,6 @@
> # SPDX-License-Identifier: GPL-2.0
>
> -TEST_GEN_PROGS := runner
> +TEST_GEN_PROGS := runner cpuhog
>
This runs cpuhog as a test as well which prints misleading timeouts.
next prev parent reply other threads:[~2026-03-11 9:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-06 16:10 [PATCH RFC 0/7] selftests/sched: Add comprehensive SCHED_DEADLINE test suite Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 1/7] selftests/sched: Add SCHED_DEADLINE test framework infrastructure Juri Lelli
2026-03-09 8:20 ` Gabriele Monaco
2026-03-09 9:10 ` Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 2/7] selftests/sched: Add SCHED_DEADLINE utility library Juri Lelli
2026-03-11 9:39 ` Christian Loehle [this message]
2026-03-11 13:15 ` Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 3/7] selftests/sched: Integrate SCHED_DEADLINE tests into kselftest framework Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 4/7] selftests/sched: Add basic SCHED_DEADLINE functionality tests Juri Lelli
2026-03-09 8:15 ` Gabriele Monaco
2026-03-09 9:11 ` Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 5/7] selftests/sched: Add SCHED_DEADLINE bandwidth tests to kselftest Juri Lelli
2026-03-11 9:31 ` Christian Loehle
2026-03-11 13:23 ` Juri Lelli
2026-03-11 13:44 ` Christian Loehle
2026-03-11 14:26 ` Christian Loehle
2026-03-12 10:43 ` Christian Loehle
2026-03-12 11:30 ` Christian Loehle
2026-03-12 14:13 ` Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 6/7] selftests/sched: Add SCHED_DEADLINE fair_server " Juri Lelli
2026-03-06 16:10 ` [PATCH RFC 7/7] selftests/sched: Add SCHED_DEADLINE ENQUEUE_REPLENISH bug test Juri Lelli
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=2d14e8b7-a7c3-46ba-b1d2-6bb6404c08fa@arm.com \
--to=christian.loehle@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=gmonaco@redhat.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shuah@kernel.org \
--cc=tommaso.cucinotta@santannapisa.it \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=williams@redhat.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