From: "Jan Beulich" Subject: Re: [PATCH 1 of 4] KEXEC: Allocate crash notes on boot Date: Fri, 09 Mar 2012 15:41:14 +0000 Message-ID: <4F5A32AA020000780007764F@nat28.tlf.novell.com> References: <977fa1c61b3ede601100.1331304121@andrewcoop.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <977fa1c61b3ede601100.1331304121@andrewcoop.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> On 09.03.12 at 15:42, Andrew Cooper wrote: > +static int __init kexec_init(void) > +{ > + void *cpu = (void *)(unsigned long)smp_processor_id(); > + > + /* If no crash area, no need to allocate space for notes. */ > + if ( !kexec_crash_area.size ) > + return 0; > + > + register_keyhandler('C', &crashdump_trigger_keyhandler); Wouldn't this better be done only after successful crash_notes allocation below? > + > + crash_notes = xmalloc_array(crash_note_range_t, nr_cpu_ids); > + if ( ! crash_notes ) > + return -ENOMEM; > + > + memset(crash_notes, 0, sizeof(crash_note_range_t) * nr_cpu_ids); Using xzalloc_array() above would be preferred. > + > + cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); > + register_cpu_notifier(&cpu_nfb); > + return 0; > +} Looks okay otherwise, but I'm still not fully convinced all this is really needed. Jan