From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 1 of 4] KEXEC: Allocate crash notes on boot Date: Fri, 9 Mar 2012 16:08:23 +0000 Message-ID: <4F5A2AF7.2090904@citrix.com> References: <977fa1c61b3ede601100.1331304121@andrewcoop.uk.xensource.com> <4F5A32AA020000780007764F@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F5A32AA020000780007764F@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 09/03/12 15:41, Jan Beulich wrote: >>>> 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? Yes >> + >> + 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. > Doh! I started this patch against unstable, with xzalloc, then ported to 4.1 without xzalloc, then ported back to unstable and forgot to change. I will respin it >> + >> + 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 > -- Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer T: +44 (0)1223 225 900, http://www.citrix.com