From: Keir Fraser Subject: Re: [RFC] KEXEC: allocate crash note buffers at boot time Date: Tue, 29 Nov 2011 11:19:03 +0000 Message-ID: References: <4ED52AF9.2080200@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4ED52AF9.2080200@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Andrew Cooper , Jan Beulich Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 29/11/2011 18:56, "Andrew Cooper" wrote: > Hello, > > As I have little to no knowledge of this stage of the boot process, is > this a sensible way to be setting up the per_cpu areas? I have a > sneaking suspicion that it will fall over if a CPU is onlined after > boot, and may also fall over if a CPU is offlined and reonlined later. > There appears to be no infrastructure currently in place for this type > of initialization, which is quite possibly why the code exists in its > current form. No it's bad. For starters you should use for_each_online_cpu, not do an open-coded for-loop. Secondly you should register a cpu hotplug notifier (register_cpu_notifier()) to pick up and handle future CPU_UP_PREPARE/CPU_UP_CANCELED/CPU_DEAD events. This can be hung off an __initcall. See common/stop_machine.c for example, or common/timer.c, which doesn't even require a for_each_online_cpu loop because its init code gets run before we bring up secondary CPUs. -- Keir > Thanks,