Re: [PATCH v3 1/8] sched/deadline: Reject debugfs dl_server writes for not-active CPUs.

From: Sebastian Andrzej Siewior

Date: Fri Nov 13 2026 - 11:02:00 EST


On 2026-11-13 15:48:32 [+0100], Juri Lelli wrote:
> Hello,
Hi,

> > --- a/kernel/sched/debug.c
> > +++ b/kernel/sched/debug.c
> > @@ -410,7 +410,7 @@ static ssize_t sched_server_write_common(struct file *filp, const char __user *u
> > return -EINVAL;
> > }
> >
> > - if (!cpu_online(cpu_of(rq)))
> > + if (!cpu_active(cpu_of(rq)))
> > return -EBUSY;
>
> Mathieu's approach [1] looks safer to me. sched_cpu_deactivate() calls
> set_cpu_active(false) without rq->lock, so a write that passed the
> cpu_active() check can still be in flight until sched_set_rq_offline()
> (which the !cpus check then has to cover). On the online side,
> set_cpu_active(true) runs before the domains rebuild, so the check lets
> the write through against the def rd's accounting. rq->online is only
> changed under the rq->lock this write already holds.

Okay. In that case let me drop this bit.

> Thanks,
> Juri

Sebastian