mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Aleksei Fedorov <ring.zero.sh@gmail.com>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, kprateek.nayak@amd.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] sched/eevdf: fall back to the leftmost entity when nobody is eligible
Date: Tue, 3 Nov 2026 13:54:49 +0100	[thread overview]
Message-ID: <20261103125449.GY1779021@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20261103124242.102319-1-ring.zero.sh@gmail.com>

On Tue, Nov 03, 2026 at 12:42:42PM +0000, Aleksei Fedorov wrote:
> pick_eevdf() returns NULL when more than one entity is runnable and
> entity_eligible() is false for every one of them, including curr. The
> caller then dereferences that pointer.
> 
> On Ubuntu linux-aws 6.8.0-1066.69 and 6.8.0-1063.66 the fault is
> pick_next_task_fair+0x91, mov r14,[rax+0xa0], RAX = 0, CR2 = 0xa0.
> Five oopses on one Xen HVM guest, from 2026-10-24 through 2026-10-28.
> commit 1560d1f6eb6b ("sched/eevdf: Prevent vlag from going out
> of bounds in reweight_eevdf()") is present in both kernels and does
> not stop the NULL return.
> 
> Take the leftmost entity so schedule() can finish. WARN_ON_ONCE records
> the substitution. It does not repair the eligibility state that rejected
> every entity.
> 
> On a guest booted with this change the warning fired once, on
> 2026-10-31 16:08:42 UTC, at pick_eevdf+0x22d in kernel/sched/fair.c:967.
> The guest was still running on 2026-11-03, with no further oops.
> 
> Signed-off-by: Aleksei Fedorov <ring.zero.sh@gmail.com>
> ---
>  kernel/sched/fair.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 0feec172f..1b940ced9 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1196,6 +1196,18 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq, bool protect)
>  	if (!best || (curr && entity_before(curr, best)))
>  		best = curr;
>  
> +	/*
> +	 * More than one entity is runnable, but none was eligible and curr
> +	 * was cleared. Returning NULL makes the caller dereference the
> +	 * result. Take the leftmost entity so schedule() can finish.
> +	 * WARN_ON_ONCE records that substitution. It does not repair the
> +	 * eligibility state that rejected every entity.
> +	 */
> +	if (unlikely(!best)) {
> +		best = __pick_first_entity(cfs_rq);
> +		WARN_ON_ONCE(best);
> +	}
> +
>  	return best;
>  }

That WARN will likely kill you as hard as a NULL deref.

Also, as I've said a million times before; getting into this situation
is bad -- something is messed up, find the root cause, fix that.

First step though, try something recent, there have been a *LOT* of
changes since 6.8

      reply	other threads:[~2026-11-03 12:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 12:42 Aleksei Fedorov
2026-11-03 12:54 ` Peter Zijlstra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261103125449.GY1779021@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=ring.zero.sh@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®