lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQF1ZZfjLBXuRl-s@fedora>
Date: Wed, 29 Oct 2025 10:01:09 +0800
From: Pingfan Liu <piliu@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: kexec@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Waiman Long <longman@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Juri Lelli <juri.lelli@...hat.com>,
	Pierre Gondois <pierre.gondois@....com>,
	Baoquan He <bhe@...hat.com>, Ingo Molnar <mingo@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Valentin Schneider <vschneid@...hat.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Joel Granados <joel.granados@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCHv2 2/2] kernel/kexec: Stop all userspace deadline tasks

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@...hat.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ