Re: Boot regression: next-20251215: arm64: WARNING: kernel/sched/core.c:10851 at sched_change_end
From: Naresh Kamboju
Date: Tue Dec 16 2025 - 13:15:39 EST
On Tue, 16 Dec 2025 at 19:47, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Tue, Dec 16, 2025 at 06:11:11PM +0530, Naresh Kamboju wrote:
> > [Re-sending with unwrapping]
> >
> > The following boot warning is noticed on qemu-arm64 booting the
> > Linux next-20251215 and next-20251216.
> >
> > Regression Analysis:
> > - New regression? Yes
> > - Reproducibility? Yes
> >
> > First seen on next-20251215
> > Bad: next-20251215 and next-20251216
> > Good: next-20251212
> >
> > Boot regression: arm64: WARNING: kernel/sched/core.c:10851 at sched_change_end
> >
> > Are these expected warnings ? Anyone noticed ?
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> Still a wrapped mess :/
>
> Anyway, afaik you're the first to notice.
<trim>
> This is:
>
> WARN_ON_ONCE(sched_class_above(ctx->class, p->sched_class) &&
> !test_tsk_need_resched(p));
>
> And rt_mutex_setprio() doesn't set need_resched() on demotion; but
> worse, reading it now, I realize that if p != current, nobody ever will.
>
> I suppose something like so will cure things?
I have tested this patch and did not encounter any regressions.
Tested-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>
>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 7d0a862a8c75..5b17d8e3cb55 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -10833,23 +10833,24 @@ void sched_change_end(struct sched_change_ctx *ctx)
> if (p->sched_class->switched_to)
> p->sched_class->switched_to(rq, p);
>
> - /*
> - * If this was a class promotion; let the old class know it
> - * got preempted. Note that none of the switch*_from() methods
> - * know the new class and none of the switch*_to() methods
> - * know the old class.
> - */
> - if (ctx->running && sched_class_above(p->sched_class, ctx->class)) {
> - rq->next_class->wakeup_preempt(rq, p, 0);
> - rq->next_class = p->sched_class;
> + if (ctx->running) {
> + /*
> + * If this was a class promotion; let the old class
> + * know it got preempted. Note that none of the
> + * switch*_from() methods know the new class and none
> + * of the switch*_to() methods know the old class.
> + */
> + if (sched_class_above(p->sched_class, ctx->class)) {
> + rq->next_class->wakeup_preempt(rq, p, 0);
> + rq->next_class = p->sched_class;
> + }
> + /*
> + * If this was a degradation in class; make sure to
> + * reschedule.
> + */
> + if (sched_class_above(ctx->class, p->sched_class))
> + resched_curr(rq);
> }
> -
> - /*
> - * If this was a degradation in class someone should have set
> - * need_resched by now.
> - */
> - WARN_ON_ONCE(sched_class_above(ctx->class, p->sched_class) &&
> - !test_tsk_need_resched(p));
> } else {
> p->sched_class->prio_changed(rq, p, ctx->prio);
> }
>
- https://tuxapi.tuxsuite.com/v1/groups/linaro/projects/lkft/tests/36wC2DzDokQEutv2FqXwjRjSv82
- Naresh