[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <806a86d3-5204-145e-af46-023bf0142aa8@csail.mit.edu>
Date: Wed, 13 Jul 2022 14:31:12 -0700
From: "Srivatsa S. Bhat" <srivatsa@...il.mit.edu>
To: Juri Lelli <juri.lelli@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-rt-users <linux-rt-users@...r.kernel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Sharan Turlapati <sturlapati@...are.com>, bordoloih@...are.com,
ankitja@...are.com, Keerthana K <keerthanak@...are.com>,
Anish Swaminathan <anishs@...are.com>,
Srivatsa Bhat <srivatsab@...are.com>
Subject: Re: [PATCH] sched/deadline: Fix BUG_ON condition for deboosted tasks
Hi Juri,
On 7/13/22 12:50 AM, Juri Lelli wrote:
> Tasks the are being deboosted from SCHED_DEADLINE might enter
> enqueue_task_dl() one last time and hit an erroneous BUG_ON condition:
> since they are not boosted anymore, the if (is_dl_boosted()) branch is
> not taken, but the else if (!dl_prio) is and inside this one we
> BUG_ON(!is_dl_boosted), which is of course false (BUG_ON triggered)
> otherwise we had entered the if branch above. Long story short, the
> current condition doesn't make sense and always leads to triggering of a
> BUG.
>
> Fix this by only checking enqueue flags, properly: ENQUEUE_REPLENISH has
> to be present, but additional flags are not a problem.
>
> Fixes: 2279f540ea7d ("sched/deadline: Fix priority inheritance with multiple scheduling classes")
It looks like this problem goes further back than the above commit
(which was merged in v5.10).
Even the oldest LTS kernel (4.9) has code like this:
if (... && p->dl.dl_boosted && ...)) {
/* code */
} else if (!dl_prio(p->normal_prio)) {
BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH);
return;
}
And we have observed crashes in the 4.19 kernel series too (CC'ed
Ankit Jain and Him Kalyan who have reproduced this issue).
I believe commit 64be6f1f5f71 ("sched/deadline: Don't replenish from a
!SCHED_DEADLINE entity") introduced the problem, which dates back to
v3.18.
Would you mind updating the Fixes: tag and adding a CC: stable tag as
well, when you respin the patch, please?
Thank you!
> Signed-off-by: Juri Lelli <juri.lelli@...hat.com>
> ---
> kernel/sched/deadline.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 5867e186c39a..0447d46f4718 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -1703,7 +1703,7 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
> * the throttle.
> */
> p->dl.dl_throttled = 0;
> - BUG_ON(!is_dl_boosted(&p->dl) || flags != ENQUEUE_REPLENISH);
> + BUG_ON(!(flags & ENQUEUE_REPLENISH));
> return;
> }
>
>
Regards,
Srivatsa
VMware Photon OS
Powered by blists - more mailing lists