From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from e06smtp15.uk.ibm.com ([195.75.94.111]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTa27-00058g-Ur for kexec@lists.infradead.org; Fri, 28 Mar 2014 16:53:40 +0000 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 28 Mar 2014 16:53:08 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id D37E917D8041 for ; Fri, 28 Mar 2014 16:53:52 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s2SGqrqC60489938 for ; Fri, 28 Mar 2014 16:52:53 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s2SGr41I019584 for ; Fri, 28 Mar 2014 10:53:05 -0600 Date: Fri, 28 Mar 2014 17:53:03 +0100 From: Petr Tesarik Subject: Re: [PATCH 2/2] makedumpfile: Use max_pfn from mem_map array Message-ID: <20140328175303.2ed0232a@holzheu> In-Reply-To: <20140328174622.2896296e@holzheu> References: <20140325171420.6b558576@holzheu> <20140326.105507.429853525.d.hatayama@jp.fujitsu.com> <20140326185426.5e2e5fc4@holzheu> <0910DD04CBD6DE4193FCF86B9C00BE971FA0EC@BPXM01GP.gisp.nec.co.jp> <20140327145441.4c956989@holzheu> <20140328120047.24a056ea@hananiah.suse.cz> <20140328174622.2896296e@holzheu> Mime-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=twosheds.infradead.org@lists.infradead.org To: Michael Holzheu Cc: Atsushi Kumagai , "d.hatayama@jp.fujitsu.com" , "kexec@lists.infradead.org" On Fri, 28 Mar 2014 17:46:22 +0100 Michael Holzheu wrote: > On Fri, 28 Mar 2014 12:00:47 +0100 > Petr Tesarik wrote: > [snip] > > That's because the bitmap length is calculated in prepare_bitmap_buffer > > using info->max_mapnr, but create_1st_bitmap() still loops over all > > PT_LOAD segments, calling set_bit_on_1st_bitmap() for each PFN. The > > offset may easily fall beyond the bitmap size. > > What about the following patch. It works for me when I specify > the "--non-cyclic" option. > > Michael > --- > [PATCH] makedumpfile: Fix bitmap create for adjusted info->max_mapnr > > If info->max_mapnr has been adjusted, for example because the dumped > system has specified the "mem=" kernel parameter, makedumpfile writes > the following error messages for Xen dumps or when the "--non-cyclic" > option has been specified: > > set_bitmap: Can't read the bitmap(/tmp/kdump_bitmap96s9V8). Success > > Fix this and consider "info->max_mapnr" in the create bitmap functions. > > Signed-off-by: Michael Holzheu > --- [snip] > @@ -7575,6 +7581,9 @@ exclude_xen4_user_domain(void) > pfn = paddr_to_pfn(phys_start); > pfn_end = paddr_to_pfn(phys_end); > size = pfn_end - pfn; > + if (pfn > info->max_mapnr) > + continue; > + pfn_end = MIN(phys_end, info->max_mapnr); Hmm, probably time for weekend. Of course this should be: pfn_end = MIN(pfn_end, info->max_mapnr); Here the updated patch: --- [PATCH] makedumpfile: Fix bitmap create for adjusted info->max_mapnr If info->max_mapnr has been adjusted, for example because the dumped system has specified the "mem=" kernel parameter, makedumpfile writes the following error messages for Xen dumps or when the "--non-cyclic" option has been specified: set_bitmap: Can't read the bitmap(/tmp/kdump_bitmap96s9V8). Success Fix this and consider "info->max_mapnr" in the create bitmap functions. Signed-off-by: Michael Holzheu --- makedumpfile.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/makedumpfile.c +++ b/makedumpfile.c @@ -4402,6 +4402,9 @@ create_1st_bitmap(void) pfn_start = paddr_to_pfn(phys_start); pfn_end = paddr_to_pfn(phys_end); + if (pfn_start > info->max_mapnr) + continue; + pfn_end = MIN(pfn_end, info->max_mapnr); for (pfn = pfn_start; pfn < pfn_end; pfn++) { set_bit_on_1st_bitmap(pfn); @@ -7511,6 +7514,9 @@ exclude_xen3_user_domain(void) pfn = paddr_to_pfn(phys_start); pfn_end = paddr_to_pfn(phys_end); size = pfn_end - pfn; + if (pfn > info->max_mapnr) + continue; + pfn_end = MIN(pfn_end, info->max_mapnr); for (j = 0; pfn < pfn_end; pfn++, j++) { print_progress(PROGRESS_XEN_DOMAIN, j + (size * i), @@ -7575,6 +7581,9 @@ exclude_xen4_user_domain(void) pfn = paddr_to_pfn(phys_start); pfn_end = paddr_to_pfn(phys_end); size = pfn_end - pfn; + if (pfn > info->max_mapnr) + continue; + pfn_end = MIN(pfn_end, info->max_mapnr); for (j = 0; pfn < pfn_end; pfn++, j++) { print_progress(PROGRESS_XEN_DOMAIN, j + (size * i), _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec