Re: [PATCH 2/2] selftests/sched_ext: Make allowed_cpus idle validation race-free
Kuba Piecuch <[email protected]> Sat, 01 Aug 2026 10:35:24 +0000
| Newsgroups | dev.linux.lists.sched-ext,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Fri Jul 31, 2026 at 3:26 PM UTC, Andrea Righi wrote: > On Fri, Jul 31, 2026 at 11:12:09AM +0000, Kuba Piecuch wrote: >> Could we check a stronger invariant by also checking that the bit in the idle >> mask is set if we're running an idle task? We can get the idle cpumask through >> scx_bpf_get_idle_cpumask() and check bits without clearing them using >> bpf_cpumask_test_cpu(). > > I don't think the other direction always holds: an idle CPU can be claimed by > another BPF idle CPU selection helper, which can clear the idle bit before the > CPU necessarily stops running the idle task. In that case, observing an idle > task with a clear idle bit is legitimate. Right, thanks for pointing that out.