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=1796319781; b=PJlVKRtfjIgp1K1niG8UxR9emsmC25+DcmW7pXQLeT175R67VDZZ/YkLAOCDSw2jSadr 7JsHu7ePi4o9J+Os4m5EDHtLUXN21f40eNiModK4slMMYzS/mbGNcm6IqUpxAHvycRvg/ +Alc9a3z+n51Aj27kC40CGRM3ScfnQ3pSXdjSg9cy8mA3Pe+ygvC+fcgeaoIAchEdZS7c vAyqYo0ND7YnODMv509bYdFiBGAL8DKGE9Mqbt5JlWheWEvOcdjzcHol8DzD3WiSGB0HR SkDXKRAmtiNwsqjryE8v5jSjyxIX1tRz7AfX/ITHYMij/d8hB5jJISs/2D/psjrpjMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796319781; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=jLln9e0whvnAnBUNAXhgDFHP8Goexr1D17MRtKp+dRc=; b=yGkjt+braimHdrcbOv17TPPb0UCf9RDF1l/EjeR2GRLqTWqB0hXDN4okogalRPbGnG+6 ZehoL35vHsM4LKLMIB4V5T3BU7hrAuc/DEi04qKxiiSvCeLscBPO0VvruO4982IjbCTZB RxE9JGpp1pGmPAsmlNyK/bID5BUZ8kERoB6Z4hJVpKGPvQz3uVI5qB3DOWvfIGsrM0/gD ZUhrokh5RrhwQFCH8ziWdaaYnjpoZsSteoZi/8xg0Bj1S7D/DGtdosCuGAnlZH+x3AMUs oylWV8lS6cpj/bYe1VmmnLAuERs9LXLfagLPoY9Zp9Ss+lDJJ9HdxL/7x+6CVe+ZO9g== 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="Tu1/RMYF"; 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 0D429606A322; Thu, 3 Dec 2026 17:43:00 +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=Tu1/RMYF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 579F61F00896; Thu, 3 Dec 2026 17:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796319780; bh=jLln9e0whvnAnBUNAXhgDFHP8Goexr1D17MRtKp+dRc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Tu1/RMYFDwxufleb7OjfTJaLq7OCaC7pLvn3wqzOE6w052+kZDJnvx3MK6jqGJ8R0 2rbAFYs176yCA5Dom2LCMl1VqCjl1aCarbseY804pkq2b82ICYTqrbK7CvPsFUTWgu RA0Noq1B6uOVLq5u3Ppq9ZAkVjJqVpAnklsmCRzo6oFwUT87pDePocvUDFOKKVDUMc NAB7Fkk+lVV4lLt5zCtWwqRkboN6bULAIQ3aWfASOp5ZTMGdoRD5hlvOU8V9gDAKKn fGI71jKsJm/D60wmzQOF0YHyTy3lda1BQ+MrOxHDcnaoPTufAKNUbxMDp10OHfNDie GANaxUR1ZhK3Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v14 31/39] sched/deadline: Record the start of the period 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: <6b1869882be16d6d09413804a673ebb3d97aaddb.1796296313.git.mathieu.desnoyers@efficios.com> References: <6b1869882be16d6d09413804a673ebb3d97aaddb.1796296313.git.mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 17:42:59 +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 2 potential issues to consider: - [Medium] sched/deadline: switched_from_dl() wipes preserved deadline and period_start - [Medium] sched/deadline: double dl_release_params() wipes constrained task period state -- commit 58b2bd6d3542e44a3b389675f5a1514b5ff34ab8 Author: Mathieu Desnoyers sched/deadline: Record the start of the period This commit adds a period_start field to struct sched_dl_entity and updates or clears it alongside deadline so that a follow-up patch can compute the next period from the period start after sched_setattr(). > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 58fc1c6c41178..820e71ee7fdf0 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c [ ... ] > @@ -4675,6 +4680,7 @@ static void switched_from_dl(struct rq *rq, struct = task_struct *p) > */ > if (!p->dl.dl_runtime) { > p->dl.deadline =3D 0; > + p->dl.period_start =3D 0; > p->dl.runtime =3D 0; > } [Severity: Medium] Can this block wipe the deadline and period_start that dl_release_params() just preserved for a constrained-deadline task? When a runnable constrained-deadline task leaves SCHED_DEADLINE past its 0-lag time, switched_from_dl() first calls task_non_contending(), which invokes dl_release_params(). That clears p->dl.dl_runtime to 0 while intentionally keeping p->dl.deadline and p->dl.period_start. The !p->dl.dl_runtime check then fires and zeroes both fields. If the task re-enters SCHED_DEADLINE before its next period, dl_check_constrained_dl() skips throttling and starts a fresh period immediately, bypassing bandwidth confinement. Checking !p->dl.dl_runtime before task_non_contending() (or using else if) would avoid clobbering the preserved state. [ ... ] > @@ -5224,12 +5231,16 @@ static void __dl_clear_params(struct sched_dl_ent= ity *dl_se) > */ > static void dl_release_params(struct sched_dl_entity *dl_se) > { > + u64 period_start =3D dl_se->period_start; > u64 deadline =3D dl_se->deadline; > bool constrained =3D !dl_is_implicit(dl_se); > =20 > __dl_clear_params(dl_se); > - if (constrained) > + if (constrained) { > + /* Keep the start of the period with its deadline. */ > + dl_se->period_start =3D period_start; > dl_se->deadline =3D deadline; > + } > } [Severity: Medium] Is dl_release_params() safe if it runs twice for a departing constrained-deadline task? When inactive_task_timer() has already fired on another CPU and is waiting for task_rq_lock(p), hrtimer_active() is still true. If the task switches out of SCHED_DEADLINE concurrently, task_non_contending() calls dl_release_params() first, and inactive_task_timer() calls it again: CPU0 CPU1 inactive_task_timer() task_rq_lock(p) (spins) switched_from_dl() task_non_contending() hrtimer_active() =3D=3D true dl_release_params() clears dl_deadline/period keeps deadline/period_start rq unlock (acquires rq lock) dl_release_params() dl_is_implicit() =3D=3D true clears deadline/period_start <-- wiped On the second call, dl_deadline and dl_period are both 0, so dl_is_implicit() returns true and __dl_clear_params() wipes the preserved deadline and period_start. A task that re-enters SCHED_DEADLINE before its next period then skips throttling in dl_check_constrained_dl(). Returning early in dl_release_params() when !dl_se->dl_deadline (or guarding the call in inactive_task_timer() on dl_se->dl_runtime) would prevent the second call from clearing the preserved state. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796296313.gi= t.mathieu.desnoyers@efficios.com?part=3D31