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=1796314215; b=Zy8Xtq6sf6MUIMKmwz3dPDAwQQHntfBYeHwI4p0LkxmbkpNMtRXE5ZtobHPcgRfTf58V WI9YBIAM32gkhRE6QnF0dL+C+Lvc3WqukW18yr4bSuLOQ3JYp5bsUo2n/d56+bN6WBxEj 0qnpsOg7QAf9/WhKi5NJuqP2OX1pgmVSrqq5BhAJr9zIy9j95YgmTFf1bEee+8DGcxyI2 ol+jP0MaPShSzGBGvHDK6wO3PRj9izSq7vWad4i8CBhP7GDS/jET4PHP07+GQS2T7rgFH UfUq90RuWQ5sN5fTJgprS2ocg8nfMYVueyaNlpVfeV8bAuiMIMNV8shDwYdnqwfB5qw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796314215; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Vh3jE3ExGvCvqTiR8y8fcfMerrkIkl9jgdQP0nBRyYo=; b=O9pkjc3muyfGa2S3NbrVvim5PNd0lckeNggpe0NtjbATkHyGdotDBqYW5uurfUlK7z4X +OgOEraTRWS9hGN1cxiIT28s3aUQM5wEqa+vuGYK+ICAM0l137+ptT6nJZAvjv7YH1Gu9 owNEHd+Yn7njIP/vkXaw6DaP03plIcSjbYdS/+p/7/Z9fJLiEx0OD0QW0xDCPGooj6tL/ kB7ekNGJOeeyPzEIdDBAGgfTE+9wUh025GTGppVTsa2q7UXVhGtMEuQa8+/l07m4GEv0r kFm4KFc3HWwoqVZZzOJ7zvdvYeeAoC+DQFxRtY5/JoMlrQj60WPSevqQYnQkvhMuhXA== 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=ANrWmJVa; 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 8EC39606A322; Thu, 3 Dec 2026 16:10:15 +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=ANrWmJVa Received: by smtp.kernel.org (Postfix) with ESMTPSA id 029DD1F0089C; Thu, 3 Dec 2026 16:10:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796314215; bh=Vh3jE3ExGvCvqTiR8y8fcfMerrkIkl9jgdQP0nBRyYo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ANrWmJVabKq9Xe9eyH1xSZrTr9Y6xv8pkgSPzMa+98bnUuOoQszwoCv28raHRbhla duNmNx1uWwMtF8pOU8wOIvtFVW9xlN84EpV75prmIM69eYXaiG2HxwGd/BqxzOmNDW SLwGgl+CSpG0XvLocf4ooCH2yvnGjGsS4wl5L/4bWKpVL1dgZ8rzbkBU0h0MDiM0wc NyeL65ude6dD6V7Zsp5cnFPKp72n6KflKtKMuervlHR91BWHYsii3x9VD0HnltFKLP udvgTUigq4PwgByCF9zMx9g2c8596S1S0IcZMhUeAuJqkjzeev0CxmFsMcc4C3nVhT MP/cIi1hkW8Ig== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v14 13/39] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild 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: <223b82dcc06380b475bb5299f51e0a07da9cab5a.1796296313.git.mathieu.desnoyers@efficios.com> References: <223b82dcc06380b475bb5299f51e0a07da9cab5a.1796296313.git.mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 16:10:14 +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 4 potential issues to consider: - [Medium] selftests/sched: hardcoded bandwidth thresholds fail on asymmetric CPUs - [Low] selftests/sched: stale cg_q partition skips rebuild in make_partition() - [Low] selftests/sched: kill() before set_other() in reap() arms 0-lag timer - [Low] selftests/sched: pick_cpus() truncates CPU mask at CPU_SETSIZE (1024) -- commit 16912fc7803a3b5fd74783e0eb69b402ea2af6a7 Author: Mathieu Desnoyers selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild This patch adds deadline_rebuild_test to test that SCHED_DEADLINE bandwidth from departing tasks is accounted correctly across root domain rebuilds and partition moves. > diff --git a/tools/testing/selftests/sched/deadline/deadline_rebuild_test= .c b/tools/testing/selftests/sched/deadline/deadline_rebuild_test.c > new file mode 100644 > index 0000000000000..735c3c65e156a > --- /dev/null > +++ b/tools/testing/selftests/sched/deadline/deadline_rebuild_test.c > @@ -0,0 +1,587 @@ [ ... ] > +static void reap(pid_t pid) > +{ > + int status; > + > + if (pid <=3D 0) > + return; > + if (kill(pid, SIGKILL) && errno !=3D ESRCH) > + ksft_print_msg("kill %d: %s\n", pid, strerror(errno)); > + /* Ignore the result: the task may be dead already. */ > + set_other(pid); > + while (waitpid(pid, &status, 0) !=3D pid) { [Severity: Low] Can sending SIGKILL before set_other() in reap() leave a 0-lag reservation behind for the next test case? In check_p(), sleeper child a is admitted to SCHED_DEADLINE at 600ms/1000ms while paused, so its dl_se->deadline is still 0. Calling kill(a, SIGKILL) first wakes a under SCHED_DEADLINE into a fresh period: parent child a (on cpu_p) reap(a) kill(a, SIGKILL) enqueue_task_dl() -> new period runs SIGKILL / do_exit() for dt > 0 set_other(a) task_non_contending() -> arms inactive_timer test_rebuild() skips sleep ... set_deadline(400ms) <-- EBUSY if timer still armed Because test_rebuild() clears ran before check_p(), it skips the post-test 1.5s wait before starting switched_out_before_rebuild. If a's inactive timer has not fired by the time the next case requests 400ms/1000ms on cpu_p, admission exceeds P's capacity and fails spuriously with EBUSY. Calling set_other(pid) before kill(pid, SIGKILL) switches a while dl_se->deadline is still 0, so dl_time_to_zerolag() returns -1 and releases the bandwidth immediately. [ ... ] > +/* Make @cg a partition root of CPU @cpu alone. Return 0, or -1 on error= . */ > +static int make_partition(const char *cg, int cpu) > +{ > + char path[PATH_MAX + 32], buf[32]; > + > + if (mkdir(cg, 0755) && errno !=3D EEXIST) > + return -1; > + snprintf(buf, sizeof(buf), "%d", cpu); > + if (write_file(cg, "cpuset.cpus", buf) || write_file(cg, "cpuset.cpus.p= artition", "root")) > + return -1; [Severity: Low] Could tolerating EEXIST here skip the root domain rebuild when a stale cg_q partition is left behind? If a previous run was interrupted while deadline_rebuild_q existed as an active partition root on cpu_q, both writes become kernel no-ops: update_cpumask() returns early when the cpumask is unchanged, and update_prstate() returns early when the partition is already a root. test_rebuild(DIES) would then never trigger a rebuild before the 0-lag time and silently pass even on a buggy kernel. Removing stale cg_p and cg_q directories at startup, or resetting cpuset.cpus.partition to "member" before setting "root", would prevent this. [ ... ] > + e1 =3D set_deadline(a, 600 * NSEC_PER_MSEC); > + e2 =3D set_deadline(b, 600 * NSEC_PER_MSEC); > + if (e1) > + ksft_print_msg("a first task refused in P: %s\n", strerror(-e1)); [Severity: Medium] Will this hardcoded 600ms/1000ms threshold cause false failures on asymmetric CPUs? pick_cpus() always selects the highest online non-isolated CPU for cpu_p, which on asymmetric topologies such as Intel hybrid or ARM big.LITTLE is often a lower-capacity core. Because __dl_overflow() scales dl_b->bw by cpu_p's capacity, a one-CPU partition on a core with capacity below roughly 680/1024 cannot admit 600ms/1000ms after the default 95% RT cap and 5% fair_server, so the first set_deadline() fails with EBUSY on a healthy kernel. Separately, main() only skips when sched_rt_runtime_us is negative; when sched_rt_runtime_us is 0 or the RT runtime ratio is too small for the hardcoded 400ms and 600ms runtimes, the test fails instead of skipping. Probing or scaling runtimes to P's available capacity, or skipping when P cannot admit the required bandwidth, would avoid these false failures. [ ... ] > +static int pick_cpus(void) > +{ > + static char online[CPU_SETSIZE], isol[CPU_SETSIZE]; > + char buf[4096]; > + int cpu, n =3D 0; > + > + if (read_file("/sys/devices/system/cpu/online", buf, sizeof(buf))) > + return 0; > + parse_cpulist(buf, online, CPU_SETSIZE); > + if (!read_file("/sys/devices/system/cpu/isolated", buf, sizeof(buf))) > + parse_cpulist(buf, isol, CPU_SETSIZE); [Severity: Low] Does capping online[], isol[], and hk_set at CPU_SETSIZE (1024) break moved_after_switch_out on systems with online CPUs >=3D 1024? When main() passes sizeof(hk_set) to sched_setaffinity(), get_user_cpu_mask() clears every CPU bit >=3D 1024 in the test process and its children. In test_move(), the child forked outside P inherits that truncated cpus_mask, which no longer covers the online non-isolated CPUs >=3D 1024 in the root domain span, so __sched_setscheduler() rejects SCHED_DEADLINE with EPERM and the test fails. Sizing the mask dynamically with CPU_ALLOC() and CPU_ALLOC_SIZE() from the highest online CPU would avoid truncating the affinity mask. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796296313.gi= t.mathieu.desnoyers@efficios.com?part=3D13