mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/ext: Fix invalid task state transitions on class switch
Date: Sat, 9 Aug 2025 09:05:57 -1000	[thread overview]
Message-ID: <aJecFbsDcVQPVcwn@slm.duckdns.org> (raw)
In-Reply-To: <20250805085911.164956-1-arighi@nvidia.com>

On Tue, Aug 05, 2025 at 10:59:11AM +0200, Andrea Righi wrote:
> When enabling a sched_ext scheduler, we may trigger invalid task state
> transitions, resulting in warnings like the following (which can be
> easily reproduced by running the hotplug selftest in a loop):
> 
>  sched_ext: Invalid task state transition 0 -> 3 for fish[770]
>  WARNING: CPU: 18 PID: 787 at kernel/sched/ext.c:3862 scx_set_task_state+0x7c/0xc0
>  ...
>  RIP: 0010:scx_set_task_state+0x7c/0xc0
>  ...
>  Call Trace:
>   <TASK>
>   scx_enable_task+0x11f/0x2e0
>   switching_to_scx+0x24/0x110
>   scx_enable.isra.0+0xd14/0x13d0
>   bpf_struct_ops_link_create+0x136/0x1a0
>   __sys_bpf+0x1edd/0x2c30
>   __x64_sys_bpf+0x21/0x30
>   do_syscall_64+0xbb/0x370
>   entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> This happens because we skip initialization for tasks that are already
> dead (with their usage counter set to zero), but we don't exclude them
> during the scheduling class transition phase.
> 
> Fix this by also skipping dead tasks during class swiching, preventing
> invalid task state transitions.
> 
> Fixes: a8532fac7b5d2 ("sched_ext: TASK_DEAD tasks must be switched into SCX on ops_enable")
> Signed-off-by: Andrea Righi <arighi@nvidia.com>

Applied to sched_ext/for-6.17-fixes.

Thanks.

-- 
tejun

      reply	other threads:[~2025-08-09 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05  8:59 Andrea Righi
2025-08-09 19:05 ` Tejun Heo [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=aJecFbsDcVQPVcwn@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=void@manifault.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®