From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796153674; b=x42rgUVE+cy9ePNAXv2KT1eXlgqCHbeJkDc2YlqFXjZRiXuF9uEl95WwTBFZFwjxJkNj M0L2iuGh31CTUYbE9h3+L6xaiSHL6ahu8XDhuniy719bsZxU+DDR8DGUs7LK1vJPSlw+l ZKzzZyG6MkdTY9GwRSOkaJNoDGl7rC9ajNj9NODLDguXADFKMIZFUYkhGntiooURtwSCM RqHmPJGzX2MyhQgBhEtVolfOzKQ7M55mdW9WRSw6IKWPy8dAaXfKUXqaQsFW/BBHf0qVr yJ8OJoCJuzIM7OpajNtr9jzlnPwFMio2ucI2ckD6layyJTkZxtRyw99t0HRmLWiHZ/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796153674; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=fNLUJu2GC5zae3FghSVHj+YG7GrbH8/qU1VeQzredVw=; b=JeJpcmbR9rGmlYdgIpAScZN3LTdyuApX4Q3bWKuPWYhrRfnar1fCdyCW1fMYmQl6azzV ZGQijVnkb+6Sq9twOV4xecQZMkPi/pmseS4OGuetL8riXi7kgzC9v08udeMuBwIJPEdp9 5iJ+eltCLhLV0AQgQNUkNrzk3m7BSMfKyeXJczR6BZPoJn69EITyWUCq5ZXdyxS9aQ5D1 ELtJ/k5Pi2sOXVP/5HiNPKin06lMuSUL3KhlcX0zTHO36l7IyGxEc9kYnQ4oramPDTgFj NwsjnQ5F+SKtYPNdQjk+mBwWmhOu+pEI2WB6q8d4ACU91O5F/cq6zB33Fcirw34G2CQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H5iFEzWn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EBE7606A31A; Tue, 1 Dec 2026 19:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H5iFEzWn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FADC1F00897; Tue, 1 Dec 2026 19:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796153673; bh=fNLUJu2GC5zae3FghSVHj+YG7GrbH8/qU1VeQzredVw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=H5iFEzWnUxG+k/ugYu2qs5MBtwxTj6Cs9u+b+U8tV2VvK4e23q5L18rg2vhAmJSG3 B/RjWOdhp8FS+TKmIaIssrbuMNgpV0Tvnv8fkgORaslmQM5xnnros90aO/CaRhfYm5 NisuDh5HPYBaqxn34nMs2rOZtus6BmQusdzb9kmLXKVMR8NqVFSKc6IwuiXQHt7ch9 D9gadNPCVBHydfeQmIwUdnJcocjTjvLGwS+eenD+wYcjKObNLT6kk+216CET1s36zk CgWz6Uoe0Cvazkk9uuqi3RgxT7X+3zYfPTZ9JJ8/NuOsjfv9kjVef+5MAmZN64o5ej Xbv2CDJkcX4BQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v13 30/36] selftests/sched: Test parameter changes in deadline_bw_test Reply-To: sashiko-reviews@lists.linux.dev To: "Mathieu Desnoyers" Cc: linux-rt-devel@lists.linux.dev, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, linux-kernel@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 19:34:33 +0000 X-Mailing-List: linux-rt-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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) > =20 > /* > * 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 t= he > * 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 befor= e. > + * 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; > =20 > /* > - * 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; > =20 > owner_tid =3D gettid_(); > + if (arg =3D=3D (void *)1L) { > + err =3D 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//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) > =20 > -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 !=3D 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 =3D=3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796146461.gi= t.mathieu.desnoyers@efficios.com?part=3D30