From: Juri Lelli <juri.lelli@redhat.com>
To: Hui Su <sh_def@163.com>
Cc: peterz@infradead.org, mingo@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, kprateek.nayak@amd.com, longman@redhat.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] sched/deadline: Fix DL server initialization for initially offline CPUs
Date: Wed, 12 Aug 2026 11:21:36 +0200 [thread overview]
Message-ID: <anw7IML1xzHys6re@jlelli-thinkpadt14gen4.remote.csb> (raw)
In-Reply-To: <20260811100612.1408592-2-sh_def@163.com>
Hi Hui Su,
On 11/08/26 18:06, Hui Su wrote:
> Commit 9f239df55546 ("sched/deadline: Initialize dl_servers after SMP")
> moved DL server initialization to sched_init_smp(), assuming that all
> CPUs are online after SMP initialization.
>
> That assumption does not hold when CPUs are intentionally left offline
> at boot, for example with maxcpus=. sched_init_dl_servers() only walks
> online CPUs, so the fair and sched_ext DL servers of an initially
> offline CPU never get their default DL parameters configured. Bringing
> the CPU online later does not run this initialization again, leaving the
> server parameters at zero.
>
> For example, boot a two-vCPU QEMU guest with maxcpus=1 and then bring
> CPU1 online:
>
> # echo 1 > /sys/devices/system/cpu/cpu1/online
> # cat /sys/kernel/debug/sched/fair_server/cpu1/runtime
> 0
> # cat /sys/kernel/debug/sched/fair_server/cpu1/period
> 0
>
> With a zero runtime the fair server cannot be activated, so fair tasks
> on the late-online CPU can be starved when higher-priority tasks
> monopolize the CPU, potentially causing user-space workloads to stall.
>
> Initialize DL servers for all possible CPUs instead. For CPUs that are
> already online, preserve the existing initialization behavior. For an
> initially offline CPU, initialize the server parameters and keep its
> bandwidth reservation local to the runqueue, but do not account it to
> the root domain until the CPU becomes active. A subsequent root-domain
> rebuild then publishes the reservation.
>
> Avoid updating the runqueue clock and setting up the current CBS period
> for offline CPUs. The configured runtime and period are initialized at
> boot, while the dynamic runtime and absolute deadline are initialized
> through the normal CBS wakeup path when the server is first started.
>
> After the fix, the same test reports:
>
> # cat /sys/kernel/debug/sched/fair_server/cpu1/runtime
> 50000000
> # cat /sys/kernel/debug/sched/fair_server/cpu1/period
> 1000000000
>
> Fixes: 9f239df55546 ("sched/deadline: Initialize dl_servers after SMP")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hui Su <sh_def@163.com>
> ---
Thanks for the fix, makes sense to me.
Acked-by: Juri Lelli <juri.lelli@redhat.com>
BTW, while reviewing, sashiko noted a related pre-existing issue in the
init=false path of dl_server_apply_params(): __dl_sub() and __dl_add() are
called unconditionally with cpus that could be 0 during CPU hot-unplug, when
the CPU is no longer active but still online. sched_server_write_common() only
checks cpu_online(), so a debugfs write during that window could hit a
divide-by-zero.
Could you take a look and consider posting an additional patch to address it?
Thanks,
Juri
next prev parent reply other threads:[~2026-08-12 9:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 10:06 Hui Su
2026-08-12 9:21 ` Juri Lelli [this message]
2026-08-12 9:42 ` Hui Su
2026-08-27 10:22 ` Hui Su
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=anw7IML1xzHys6re@jlelli-thinkpadt14gen4.remote.csb \
--to=juri.lelli@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sh_def@163.com \
--cc=stable@vger.kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®