From: sashiko-bot@kernel.org
To: "Tejun Heo" <tj@kernel.org>
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH 2/2] sched_ext: Maintain an online cid mask in the scheduler arena
Date: Tue, 15 Sep 2026 08:58:18 +0000 [thread overview]
Message-ID: <20260915085819.5DB991F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915082725.3881071-3-tj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] sched_ext: bit corruption in online_cmask on 32-bit big-endian architectures
--
commit caa3d27a5f1591e49ffdf405f84e61f1f37a10f5
Author: Tejun Heo <tj@kernel.org>
sched_ext: Maintain an online cid mask in the scheduler arena
This commit adds a kernel-maintained online cid mask in the scheduler's
arena for child schedulers. It populates this mask after the cid mapping
is finalized and tracks online/offline states based on hotplug notifications.
> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 10af28a9f2c0c..7fbef7f11d3ae 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
[ ... ]
> @@ -3663,8 +3663,20 @@ static void handle_hotplug(struct rq *rq, bool online)
> s16 *tbl = rcu_dereference_check(scx_cpu_to_cid_tbl,
> lockdep_is_cpus_held());
>
> - if (tbl)
> + if (tbl) {
> + struct scx_sched *pos;
> +
> cpu_or_cid = tbl[cpu];
> +
> + guard(raw_spinlock_irqsave)(&scx_sched_lock);
> + list_for_each_entry(pos, &scx_sched_all, all) {
> + struct scx_cmask *mask = pos->online_cmask;
> +
> + if (mask)
> + __assign_bit(cpu_or_cid, (unsigned long *)mask->bits,
> + online);
[Severity: Medium]
Does casting mask->bits to an unsigned long pointer corrupt the bitmask
layout on 32-bit big-endian architectures?
Since mask->bits is declared as a u64 array in struct scx_cmask, BPF
programs expect a standard 64-bit integer bit layout. However,
__assign_bit() operates on native words. On 32-bit big-endian systems,
the most significant 32 bits are at offset 0, meaning __assign_bit(0)
modifies bit 32 of the underlying u64 instead of bit 0.
This would cause BPF programs to observe bit cpu_or_cid + 32 toggled
instead of cpu_or_cid, which could lead to dispatching tasks to offline
CPUs or starving tasks on online CPUs.
> + }
> + }
> }
>
> if (online && SCX_HAS_OP(sch, cpu_online))
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915082725.3881071-1-tj@kernel.org?part=2
next prev parent reply other threads:[~2026-09-15 8:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 8:27 [PATCHSET v2 sched_ext/for-7.3-fixes] sched_ext: Idle claim recovery and online cid mask Tejun Heo
2026-09-15 8:27 ` [PATCH 1/2] sched_ext: scx_qmap: Restore unused idle claims from ops.dispatch() Tejun Heo
2026-09-15 8:27 ` [PATCH 2/2] sched_ext: Maintain an online cid mask in the scheduler arena Tejun Heo
2026-09-15 8:58 ` sashiko-bot [this message]
2026-09-15 16:54 ` Tejun Heo
2026-09-15 12:27 ` [PATCHSET v2 sched_ext/for-7.3-fixes] sched_ext: Idle claim recovery and online cid mask Andrea Righi
2026-09-15 17:01 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2026-09-14 23:42 [PATCHSET sched_ext/for-7.3-fixes] sched_ext: Idle repick notifications " Tejun Heo
2026-09-14 23:42 ` [PATCH 2/2] sched_ext: Maintain an online cid mask in the scheduler arena Tejun Heo
2026-09-15 0:03 ` sashiko-bot
2026-09-15 5:44 ` Andrea Righi
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=20260915085819.5DB991F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.