Linux real-time development
 help / color / mirror / Atom feed
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 v9 28/33] selftests/sched: Test deadline boosts in deadline_bw_test
Date: Fri, 20 Nov 2026 14:26:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-225360@kernel.org> (raw)
In-Reply-To: <3c1582ebc8887e6cb2183b47ee746c93878ce8cc.1795181240.git.mathieu.desnoyers@efficios.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/sched: asleep_donor() 1s period in
  deboost_out_asleep_after_refill() outlasts 300ms probe wait
--

commit d2e9c0f7968d87de2ffed7f0becb6e1c373c9c07
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

selftests/sched: Test deadline boosts in deadline_bw_test

This commit adds eight test cases to deadline_bw_test covering SCHED_DEADLINE
priority inheritance boost and deboost scenarios, runtime refills from a
donor, and waiter ordering on PI locks.

> diff --git a/tools/testing/selftests/sched/deadline/deadline_bw_test.c b/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> index 25fbbc3e88d00..5ea9bfe0aee2c 100644
> --- a/tools/testing/selftests/sched/deadline/deadline_bw_test.c
> +++ b/tools/testing/selftests/sched/deadline/deadline_bw_test.c

[ ... ]

> @@ -1938,6 +2065,326 @@ static int deboost_keeps_own_runtime(void)
>  	return ret;
>  }
>  
> +/* Run refill_case() with an owner that is refilled from its donor. */

[ ... ]

> +static void *asleep_donor(void *arg)
> +{
> +	struct timespec ts;
> +	int err;
> +
> +	aslp_donor_tid = gettid_();
> +	err = set_deadline(0, NSEC_PER_MSEC, NSEC_PER_SEC);
> +	sem_post(&aslp_donor_ready);
> +	if (err) {
> +		ksft_print_msg("the donor refused as a deadline task: %s\n", strerror(-err));
> +		return (void *)1;
> +	}
> +	if (sem_wait_for(&aslp_owner_locked, 5000)) {
> +		ksft_print_msg("the owner did not take the lock\n");
> +		return (void *)1;
> +	}
> +	clock_gettime(CLOCK_REALTIME, &ts);
> +	ts.tv_nsec += 200 * 1000000L;
> +	ts.tv_sec += ts.tv_nsec / 1000000000L;
> +	ts.tv_nsec %= 1000000000L;
> +	aslp_donor_locking = 1;
> +	err = pthread_mutex_timedlock(&pi_lock, &ts);
> +	aslp_total_bw = total_bw_of(top_cpu(1));

[Severity: Low]
Can asleep_donor()'s 1s period outlast the 300ms wait in measured(), causing
probe() to fail with a false bandwidth leak?

asleep_donor() runs with a 1ms runtime and 1s period (a 1000:1 ratio).
Its initial 0-lag time passes during the 200ms timedlock sleep, so waking
on timeout replenishes a new 1s period.  It then calls total_bw_of(), which
reads /sys/kernel/debug/sched/debug while still in SCHED_DEADLINE.  Each
microsecond of CPU time spent there pushes its 0-lag time forward by 999us,
so spending more than ~300us leaves its bandwidth active past the 3 * PERIOD
(300ms) sleep in measured(), and probe(cg_p) admits 8 tasks instead of 9.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795181240.git.mathieu.desnoyers@efficios.com?part=28

  reply	other threads:[~2026-11-20 14:26 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 13:55 [PATCH v9 00/33] sched/deadline: bandwidth accounting fixes and selftests Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 01/33] sched/deadline: Keep departing bandwidth across a root domain rebuild Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 02/33] sched/deadline: Rebuild the root domains' accounting from the task list Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 03/33] sched/deadline: Record the root domain holding a task's bandwidth Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 04/33] sched/deadline: Leave a dying task out of a rebuild of the accounting Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 05/33] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 06/33] selftests/sched: Test the root domain rebuild in deadline_bw_test Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 07/33] sched/deadline: Move a task's bandwidth only where room was made Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 08/33] cgroup/cpuset: Wait for an attach before rebuilding the sched domains Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 09/33] sched: Make deadline policy and affinity changes wait for a cpuset attach Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 10/33] cgroup/cpuset: Give back the bandwidth an attach did not move Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 11/33] cgroup/cpuset: Reserve the bandwidth in the root domain a task moves to Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 12/33] selftests/sched: Test cpuset moves in deadline_bw_test Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 13/33] sched/deadline: Make a rebuild count a task in the root domain it runs in Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 14/33] sched/deadline: Move a task's bandwidth to " Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 15/33] sched/deadline: Keep a task in the root domain that counts its bandwidth Mathieu Desnoyers
2026-11-20 14:12   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 16/33] sched/deadline: Keep the last CPU a task has in its root domain Mathieu Desnoyers
2026-11-20 14:31   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 17/33] cgroup/cpuset: Refuse to take a deadline task out of " Mathieu Desnoyers
2026-11-20 14:32   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 18/33] selftests/sched: Test the root domain of a task in deadline_bw_test Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 19/33] sched/deadline: Count only active CPUs when spreading extra_bw Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 20/33] rtmutex: Continue the chain walk when a waiter's deadline donor changes Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 21/33] rtmutex: Continue the walk when the owner's top waiter changes lock Mathieu Desnoyers
2026-11-20 14:20   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 22/33] selftests/sched: Test the rtmutex chain walk in deadline_bw_test Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 23/33] sched/deadline: Reset the donor's runtime at a deboost in the class Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 24/33] sched/deadline: Replenish a throttled task boosted while asleep Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 25/33] sched/deadline: Count the bandwidth a boosted task is given Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 26/33] sched/deadline: Start a period for a task that enters the class blocked Mathieu Desnoyers
2026-11-20 14:39   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 27/33] sched/deadline: Start a period at a deboost out of the class Mathieu Desnoyers
2026-11-20 14:27   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 28/33] selftests/sched: Test deadline boosts in deadline_bw_test Mathieu Desnoyers
2026-11-20 14:26   ` sashiko-bot [this message]
2026-11-20 13:55 ` [PATCH v9 29/33] sched/deadline: Cancel the replenishment timer with the parameters Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 30/33] sched/deadline: Cap the runtime left of a constrained task at dl_runtime Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 31/33] sched/deadline: Check the runtime of a task that comes back runnable Mathieu Desnoyers
2026-11-20 13:55 ` [PATCH v9 32/33] sched/deadline: Check the runtime of a task whose parameters change Mathieu Desnoyers
2026-11-20 14:58   ` sashiko-bot
2026-11-20 13:55 ` [PATCH v9 33/33] selftests/sched: Test parameter changes in deadline_bw_test 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-225360@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox