From: Pingfan Liu <piliu@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
Waiman Long <longman@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Pierre Gondois <pierre.gondois@arm.com>,
Baoquan He <bhe@redhat.com>, Ingo Molnar <mingo@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Valentin Schneider <vschneid@redhat.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Joel Granados <joel.granados@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCHv2 2/2] kernel/kexec: Stop all userspace deadline tasks
Date: Wed, 29 Oct 2025 10:01:09 +0800 [thread overview]
Message-ID: <aQF1ZZfjLBXuRl-s@fedora> (raw)
In-Reply-To: <20251028163911.98990cbf1516d1c6d221f92b@linux-foundation.org>
On Tue, Oct 28, 2025 at 04:39:11PM -0700, Andrew Morton wrote:
> On Tue, 28 Oct 2025 11:09:14 +0800 Pingfan Liu <piliu@redhat.com> wrote:
>
> > Now that the deadline bandwidth check has been skipped, there is nothing
> > to prevent CPUs from being unplugged. But as deadline tasks are crowded
> > onto the remaining CPUs, they may starve normal tasks, especially the
> > hotplug kthreads. As a result, the kexec process will hang indefinitely.
> >
> > Send SIGSTOP to all userspace deadline tasks at the beginning of kexec
> > to allow other tasks to run as CPUs are unplugged.
>
> This all looks a bit hacky.
>
> What's special about kexec? If many CPUs are being unplugged via other
> means, won't the kernel still hit the very problems which are being
> addressed here for kexec? If so, we should seek a general fix for these
No, they are in different situations. For normal CPU hot-removal, the
deadline bandwidth validation will prevent the CPU hot-removal if the
bandwidth requirements are not met. But in the kexec case, there is no
way to roll back, so it must try its best to proceed. That is why the
previous patch is introduced.
> issues rather than a kexec-specific one?
>
> > --- a/kernel/kexec_core.c
> > +++ b/kernel/kexec_core.c
> > @@ -1132,6 +1132,18 @@ bool kexec_load_permitted(int kexec_image_type)
> > return true;
> > }
> >
> > +static void stop_user_deadline_tasks(void)
> > +{
> > + struct task_struct *task;
> > +
> > + rcu_read_lock();
> > + for_each_process(task) {
> > + if (task->policy == SCHED_DEADLINE && task->mm)
> > + send_sig(SIGSTOP, task, 1);
> > + }
> > + rcu_read_unlock();
> > +}
>
> If we can safely stop all SCHED_DEADLINE user tasks then presumably we
> can safely stop all user tasks. Why not do that?
>
I think it can be done that way. Normal user tasks cannot block the CPU
hotplug kthread. Once the other CPUs are offlined, kexec can jump to the
new kernel immediately. However, DL tasks may starve the hotplug kthread
and kexec task, which is why I take this cautious approach.
Thanks,
Pingfan
prev parent reply other threads:[~2025-10-29 2:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-28 3:09 [PATCHv2 0/2]: kexec: Force kexec to proceed under heavy deadline load Pingfan Liu
2025-10-28 3:09 ` [PATCHv2 1/2] sched/deadline: Skip the deadline bandwidth check if kexec_in_progress Pingfan Liu
2025-10-28 3:09 ` [PATCHv2 2/2] kernel/kexec: Stop all userspace deadline tasks Pingfan Liu
2025-10-28 23:39 ` Andrew Morton
2025-10-29 2:01 ` Pingfan Liu [this message]
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=aQF1ZZfjLBXuRl-s@fedora \
--to=piliu@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=dietmar.eggemann@arm.com \
--cc=joel.granados@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pierre.gondois@arm.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--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