From: sashiko-bot@kernel.org
To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
Cc: linux-rt-devel@lists.linux.dev, tj@kernel.org,
hannes@cmpxchg.org, mkoutny@suse.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v13 30/36] selftests/sched: Test parameter changes in deadline_bw_test
Date: Tue, 01 Dec 2026 19:34:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-244087@kernel.org> (raw)
In-Reply-To: <ad677bee9bb0e8c00dfb4db563b2fba8ba9e55b2.1796146461.git.mathieu.desnoyers@efficios.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: dead test modes in pi_asleep(), deboost_case(),
and helpers
--
commit 3c3e678183963bfa600f0de3703c72db233a7225
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
selftests/sched: Test parameter changes in deadline_bw_test
This commit adds 24 parameter-change and constrained-gap test cases to
deadline_bw_test and waits for bandwidth and debt release between cases in
run_p_cases().
> diff --git a/tools/testing/selftests/sched/deadline/deadline_bw_test.c b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> index 07beae8ca202d..bca333d5498c6 100644
> --- a/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> +++ b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
[ ... ]
> @@ -893,30 +929,50 @@ static void *sleeping_owner(void *arg)
>
> /*
> * A SCHED_OTHER owner takes pi_lock and sleeps 400ms while holding it.
> - * The main thread then waits 20ms for the lock, 5 times. For each wait it
> - * becomes a deadline task of 5ms every 50ms. Each wait boosts the
> + * The main thread then waits 20ms for the lock, @rounds times. For each
> + * wait it becomes a deadline task of 5ms every 50ms. Each wait boosts the
> * sleeping owner, and its timeout deboosts it. Every wait must time out.
> + *
> + * With @was_dl, the owner was a deadline task of 30ms every 100ms before.
> + * It ran 1ms and slept. The main thread switched it to SCHED_OTHER 200ms
> + * later, past its 0-lag time.
> */
> -static int pi_other_owner_asleep(void)
> +static int pi_asleep(int was_dl, int rounds)
[ ... ]
> +static int pi_other_owner_asleep(void)
> +{
> + return pi_asleep(0, 5);
> +}
> +
> /*
> * Run as the owner thread. Become a deadline task of 30ms every 100ms,
> * and take pi_lock. Hold it for 300ms, spinning 2ms and sleeping 5ms in
> @@ -1632,9 +1693,9 @@ static atomic_int owner_first_period_ms;
> static _Atomic pid_t donor_tid;
>
> /*
> - * Run as the owner O of deboost_resets_period(). Store the CPU time of
> - * step 4, in ms, in owner_first_period_ms. Return NULL, 1 on an error, or
> - * 2 if no waiter boosted it within 1s.
> + * Run as the owner O of deboost_case(). @arg is its @mode. Store the CPU
> + * time of step 4, in ms, in owner_first_period_ms. Return NULL, 1 on an
> + * error, or 2 if no waiter boosted it within 1s.
> */
> static void *deboosted_owner(void *arg)
> {
> @@ -1642,6 +1703,17 @@ static void *deboosted_owner(void *arg)
> int err;
>
> owner_tid = gettid_();
> + if (arg == (void *)1L) {
> + err = set_deadline(0, 60 * NSEC_PER_MSEC, PERIOD);
> + if (err) {
> + ksft_print_msg("the owner refused as a deadline task: %s\n",
> + strerror(-err));
> + return (void *)1;
> + }
> + spin_ns(NSEC_PER_MSEC);
> + sem_post(&owner_ready);
> + sem_wait_sig(&owner_go);
> + }
[ ... ]
> +/* Run deboost_case() with a plain SCHED_OTHER owner. */
> +static int deboost_resets_period(void)
> +{
> + return deboost_case(0);
> +}
> +
> /*
> * Return the runtime that the deadline task @tid has left, in ns, from
> * dl.runtime in /proc/<tid>/sched. Return -1 if it cannot be read.
> @@ -1779,14 +1891,16 @@ static long long dl_runtime_left(pid_t tid)
> #define REFILL_DONOR_RUNTIME (2 * NSEC_PER_MSEC)
> #define REFILL_DONOR_PERIOD (10 * NSEC_PER_MSEC)
>
> -static sem_t refill_donor_ready;
> -static atomic_int refill_donor_locking;
> -static _Atomic long long refill_owner_left;
> +static sem_t refill_donor_ready, refill_measured;
> +static atomic_int refill_donor_locking, refill_hold_donor;
> +static _Atomic long long refill_owner_left, refill_owner_read_ms;
[ ... ]
> +/* Run refill_case() with an owner that stays on its own runtime. */
> +static int deboost_keeps_own_runtime(void)
> +{
> + return refill_case(1);
> +}
> +
> +static sem_t ret_ready, ret_go;
> +static _Atomic pid_t ret_tid;
> +static atomic_int ret_first_period_ms;
> +
> +/*
> + * Run as the thread of the return cases. Become a deadline task of 50ms
> + * every 100ms and run 20ms. 30ms of runtime are left, and the 0-lag time
> + * is about 20ms ahead. Then change to new parameters, as @arg says:
> + * - 0: the thread switches itself to SCHED_OTHER and back to
> + * SCHED_DEADLINE, while it runs.
> + * - 1: the thread sleeps. The main thread switches it to SCHED_OTHER and
> + * back.
> + * - 2: the thread changes its own parameters while it runs. It stays in
> + * SCHED_DEADLINE.
> + * - 3: as 2, while a donor boosts the thread. The thread takes pi_lock and
> + * wakes the donor up. The donor blocks on pi_lock. The thread then
> + * changes its parameters, and unlocks.
> + * - 4: as 2, to a constrained deadline: 8ms in 20ms, every 100ms.
> + * - 5: the thread sleeps. The main thread changes it to 8ms in 20ms,
> + * every 100ms.
[ ... ]
> +static int return_running_new_params(void)
> +{
> + return return_case(0);
> +}
> +
> +/* The same, for a task that leaves and comes back while it sleeps. */
> +static int return_asleep_new_params(void)
> +{
> + return return_case(1);
> +}
> +
> +/* The same, for a task that changes its parameters within the class. */
> +static int change_running_new_params(void)
> +{
> + return return_case(2);
> +}
> +
> +/*
> + * A running task of 50ms every 100ms has 30ms left. It changes itself to
> + * 8ms in 20ms, every 100ms. Its deadline stays 80ms ahead, further than
> + * the new 20ms. The check of the runtime left uses the new density over
> + * those 80ms. That allows 32ms, so the check keeps the 30ms. The task
> + * must keep no more than its new 8ms.
> + */
> +static int change_constrained_new_params(void)
> +{
> + return return_case(4);
> +}
> +
> +/*
> + * The same, for a task that the main thread changes while it sleeps. The
> + * check is at its wakeup.
> + */
> +static int wake_constrained_new_params(void)
> +{
> + return return_case(5);
> +}
[Severity: Low]
Are several new test modes in pi_asleep(), deboost_case(), refill_case(),
and return_case() missing wrappers and entries in p_cases[]?
This patch adds code and documentation for five scenarios that are never
called:
- pi_asleep() adds a was_dl != 0 branch, but is only called as
pi_asleep(0, 5) in pi_other_owner_asleep().
- deboost_case() and deboosted_owner() add modes 1 and 2, but
deboost_resets_period() only calls deboost_case(0). Also, in mode 1 of
deboosted_owner(), if set_deadline() fails, the thread returns without
posting owner_ready, so deboost_case(1) would wait for the full 5s
timeout in sem_wait_for(&owner_ready, 5000).
- refill_case() adds a spin_ms == 8 branch and refill_donor() adds
refill_hold_donor and refill_measured, but deboost_keeps_own_runtime()
only calls refill_case(1) and the two new globals are never initialized
or set.
- return_case() and returner() add mode 3, while wrappers and p_cases[]
entries are only added for modes 0, 1, 2, 4, and 5.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796146461.git.mathieu.desnoyers@efficios.com?part=30
next prev parent reply other threads:[~2026-12-01 19:34 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 17:43 [PATCH v13 00/36] sched/deadline: bandwidth accounting fixes and selftests Mathieu Desnoyers
2026-12-01 17:43 ` [PATCH v13 01/36] sched/deadline: Hold a reference on the deadline donor of a boosted task Mathieu Desnoyers
2026-12-01 17:43 ` [PATCH v13 02/36] sched/deadline: Replenish a throttled task boosted while asleep Mathieu Desnoyers
2026-12-01 17:43 ` [PATCH v13 03/36] sched/deadline: Do not truncate a bandwidth to 32 bits in __dl_add/sub() Mathieu Desnoyers
2026-12-01 17:43 ` [PATCH v13 04/36] sched/deadline: Count the 0-lag time from the next period Mathieu Desnoyers
2026-12-01 17:43 ` [PATCH v13 05/36] sched/deadline: Keep a departing constrained task until its " Mathieu Desnoyers
2026-12-01 18:17 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 06/36] sched/deadline: Keep departing bandwidth across a root domain rebuild Mathieu Desnoyers
2026-12-01 18:20 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 07/36] sched/deadline: Rebuild the root domains' accounting from the task list Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 08/36] sched/deadline: Record the root domain holding a task's bandwidth Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 09/36] sched/deadline: Leave a dying task out of a rebuild of the accounting Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 10/36] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 11/36] selftests/sched: Test the root domain rebuild in deadline_bw_test Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 12/36] sched/deadline: Move a task's bandwidth only where room was made Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 13/36] cgroup/cpuset: Wait for an attach before rebuilding the sched domains Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 14/36] sched: Make deadline policy and affinity changes wait for a cpuset attach Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 15/36] cgroup/cpuset: Give back the bandwidth an attach did not move Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 16/36] cgroup/cpuset: Reserve the bandwidth in the root domain a task moves to Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 17/36] selftests/sched: Test cpuset moves in deadline_bw_test Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 18/36] sched/deadline: Make a rebuild count a task in the root domain it runs in Mathieu Desnoyers
2026-12-01 19:11 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 19/36] sched/deadline: Move a task's bandwidth to " Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 20/36] sched/deadline: Keep a task in the root domain that counts its bandwidth Mathieu Desnoyers
2026-12-01 19:02 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 21/36] sched/deadline: Keep the last CPU a task has in its root domain Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 22/36] cgroup/cpuset: Refuse to take a deadline task out of " Mathieu Desnoyers
2026-12-01 19:29 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 23/36] selftests/sched: Test the root domain of a task in deadline_bw_test Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 24/36] sched/deadline: Count only active CPUs when spreading extra_bw Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 25/36] sched/deadline: Cancel the replenishment timer with the parameters Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 26/36] sched/deadline: Cap the runtime left of a constrained task at dl_runtime Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 27/36] sched/deadline: Check the runtime of a task that comes back runnable Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 28/36] sched/deadline: Record the start of the period Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 29/36] sched/deadline: Keep the debt of a task across a change of parameters Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 30/36] selftests/sched: Test parameter changes in deadline_bw_test Mathieu Desnoyers
2026-12-01 19:34 ` sashiko-bot [this message]
2026-12-01 17:44 ` [PATCH v13 31/36] sched/deadline: Count a task that departs while a rebuild walks the tasks Mathieu Desnoyers
2026-12-01 19:41 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 32/36] sched/deadline: Count again a departed task that a boost brings back Mathieu Desnoyers
2026-12-01 19:47 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 33/36] sched/deadline: Keep a reaped deadline task in a rebuild Mathieu Desnoyers
2026-12-01 19:57 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 34/36] sched/deadline: Warn when a runqueue keeps the bandwidth of a task Mathieu Desnoyers
2026-12-01 17:44 ` [PATCH v13 35/36] selftests/sched: Test PI against hotplug and rebuilds in deadline_bw_test Mathieu Desnoyers
2026-12-01 19:51 ` sashiko-bot
2026-12-01 17:44 ` [PATCH v13 36/36] selftests/sched: Share the helpers of the deadline tests Mathieu Desnoyers
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-244087@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mkoutny@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tj@kernel.org \
/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.