From: Tejun Heo <tj@kernel.org>
To: Zhao Mengmeng <zhaomzhao@126.com>
Cc: void@manifault.com, arighi@nvidia.com, changwoo@igalia.com,
emil@etsalapatis.com, sched-ext@lists.linux.dev,
linux-kernel@vger.kernel.org, zhaomengmeng@kylinos.cn
Subject: Re: [PATCH] tools/sched_ext: scx_central: start timer from central dispatch
Date: Thu, 26 Mar 2026 14:58:26 -1000 [thread overview]
Message-ID: <acXWMnYJPD_uGf_l@slm.duckdns.org> (raw)
In-Reply-To: <20260326091523.299333-1-zhaomzhao@126.com>
Hello, Zhao.
On Thu, Mar 26, 2026 at 05:15:23PM +0800, Zhao Mengmeng wrote:
> From: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
>
> scx_central currently assumes that ops.init() runs on the selected
> central CPU and aborts otherwise. This is no longer true, as ops.init()
> is invoked from the scx_enable_helper thread, which can run on any
> CPU. As a result, sched_setaffinity() from userspace doesn't work, loading
> scx_central can fail with:
>
> [ 1985.319942] sched_ext: central: scx_central.bpf.c:314: init from non-central CPU
> [ 1985.320317] scx_exit+0xa3/0xd0
> [ 1985.320535] scx_bpf_error_bstr+0xbd/0x220
> [ 1985.320840] bpf_prog_3a445a8163fa8149_central_init+0x103/0x1ba
> [ 1985.321073] bpf__sched_ext_ops_init+0x40/0xa8
> [ 1985.321286] scx_root_enable_workfn+0x507/0x1650
> [ 1985.321461] kthread_worker_fn+0x260/0x940
> [ 1985.321745] kthread+0x303/0x3e0
> [ 1985.321901] ret_from_fork+0x589/0x7d0
> [ 1985.322065] ret_from_fork_asm+0x1a/0x30
>
> DEBUG DUMP
> ===================================================================
>
> central: root
> scx_enable_help[134] triggered exit kind 1025:
> scx_bpf_error (scx_central.bpf.c:314: init from non-central CPU)
>
> To fix it, initialize the BPF timer from ops.init(), but defer
> bpf_timer_start() to the first dispatch on the central CPU. This preserves
> the requirement that the timer be started from the central CPU when
> BPF_F_TIMER_CPU_PIN is used, without depending on the CPU affinity of
> the enable path.
Can you do the followings please?
- Remove now unnecessary sched_setaffinity() call.
- Do scx_bpf_kick_cpu(central_cpu, 0) so that we're guaranteed to enter the
dispatch path on the central CPU immediately.
Thanks.
--
tejun
next prev parent reply other threads:[~2026-03-27 0:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 9:15 Zhao Mengmeng
2026-03-27 0:58 ` Tejun Heo [this message]
2026-03-27 1:26 ` Zhao Mengmeng
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=acXWMnYJPD_uGf_l@slm.duckdns.org \
--to=tj@kernel.org \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=void@manifault.com \
--cc=zhaomengmeng@kylinos.cn \
--cc=zhaomzhao@126.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®