From patchwork Wed Apr 10 07:10:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atsushi Kumagai X-Patchwork-Id: 235314 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 6CB3A2C0147 for ; Wed, 10 Apr 2013 17:18:03 +1000 (EST) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9438A2C013E for ; Wed, 10 Apr 2013 17:17:24 +1000 (EST) Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r3A7HLBv023141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 10 Apr 2013 16:17:21 +0900 (JST) Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r3A7HIj8029865; Wed, 10 Apr 2013 16:17:18 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id r3A7HIG01250; Wed, 10 Apr 2013 16:17:18 +0900 (JST) Received: from mail01b.kamome.nec.co.jp (mail01b.kamome.nec.co.jp [10.25.43.2]) by mailsv4.nec.co.jp (8.13.8/8.13.4) with ESMTP id r3A7HI8j005312; Wed, 10 Apr 2013 16:17:18 +0900 (JST) Received: from shikibu.jp.nec.com ([10.26.220.2] [10.26.220.2]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-290144; Wed, 10 Apr 2013 16:10:48 +0900 Received: from NES2091000330.nsl.ad.nec.co.jp ([10.21.40.240] [10.21.40.240]) by mail.jp.nec.com with ESMTP; Wed, 10 Apr 2013 16:10:48 +0900 Date: Wed, 10 Apr 2013 16:10:48 +0900 From: Atsushi Kumagai To: kexec@lists.infradead.org Subject: [RESEND PATCH 2/4] Use vmap_area_list to get vmalloc_start for i386. Message-Id: <20130410161048.44aa90f89ac7aae8ab259c84@mxc.nes.nec.co.jp> In-Reply-To: <20130410150524.804cd23b99a697f71146be67@mxc.nes.nec.co.jp> References: <20130410150524.804cd23b99a697f71146be67@mxc.nes.nec.co.jp> X-Mailer: Sylpheed 3.3.0 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Cc: linuxppc-dev@lists.ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Atsushi Kumagai Date: Thu, 14 Mar 2013 19:10:49 +0900 Subject: [PATCH 2/4] Use vmap_area_list to get vmalloc_start for i386. Try to get vmalloc_start value from vmap_area_list first for newer i386 kernels. Signed-off-by: Atsushi Kumagai --- arch/x86.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/arch/x86.c b/arch/x86.c index ef29e3c..e397905 100644 --- a/arch/x86.c +++ b/arch/x86.c @@ -70,7 +70,7 @@ remap_init(void) int get_machdep_info_x86(void) { - unsigned long vmlist, vmalloc_start; + unsigned long vmlist, vmap_area_list, vmalloc_start; /* PAE */ if ((vt.mem_flags & MEMORY_X86_PAE) @@ -100,22 +100,40 @@ get_machdep_info_x86(void) return FALSE; /* - * For the compatibility, makedumpfile should run without the symbol - * vmlist and the offset of vm_struct.addr if they are not necessary. + * Get vmalloc_start value from either vmap_area_list or vmlist. */ - if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL) - || (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) { + if ((SYMBOL(vmap_area_list) != NOT_FOUND_SYMBOL) + && (OFFSET(vmap_area.va_start) != NOT_FOUND_STRUCTURE) + && (OFFSET(vmap_area.list) != NOT_FOUND_STRUCTURE)) { + if (!readmem(VADDR, SYMBOL(vmap_area_list) + OFFSET(list_head.next), + &vmap_area_list, sizeof(vmap_area_list))) { + ERRMSG("Can't get vmap_area_list.\n"); + return FALSE; + } + if (!readmem(VADDR, vmap_area_list - OFFSET(vmap_area.list) + + OFFSET(vmap_area.va_start), &vmalloc_start, + sizeof(vmalloc_start))) { + ERRMSG("Can't get vmalloc_start.\n"); + return FALSE; + } + } else if ((SYMBOL(vmlist) != NOT_FOUND_SYMBOL) + && (OFFSET(vm_struct.addr) != NOT_FOUND_STRUCTURE)) { + if (!readmem(VADDR, SYMBOL(vmlist), &vmlist, sizeof(vmlist))) { + ERRMSG("Can't get vmlist.\n"); + return FALSE; + } + if (!readmem(VADDR, vmlist + OFFSET(vm_struct.addr), &vmalloc_start, + sizeof(vmalloc_start))) { + ERRMSG("Can't get vmalloc_start.\n"); + return FALSE; + } + } else { + /* + * For the compatibility, makedumpfile should run without the symbol + * used to get vmalloc_start value if they are not necessary. + */ return TRUE; } - if (!readmem(VADDR, SYMBOL(vmlist), &vmlist, sizeof(vmlist))) { - ERRMSG("Can't get vmlist.\n"); - return FALSE; - } - if (!readmem(VADDR, vmlist + OFFSET(vm_struct.addr), &vmalloc_start, - sizeof(vmalloc_start))) { - ERRMSG("Can't get vmalloc_start.\n"); - return FALSE; - } info->vmalloc_start = vmalloc_start; DEBUG_MSG("vmalloc_start: %lx\n", vmalloc_start);