Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp473889imm; Fri, 27 Jul 2018 00:00:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpergSDfDp81V6lVme2zVNzw+2pj1ReA9CBSIOjqvXTWx22wYFOu0jfKWiJDVpweHegDDWVM X-Received: by 2002:a17:902:6b89:: with SMTP id p9-v6mr490968plk.272.1532674812899; Fri, 27 Jul 2018 00:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532674812; cv=none; d=google.com; s=arc-20160816; b=WxhfCh5rRBcG1BnvAOueGkW2LPSLafTz79Gb3M0VLB+JqEw1Bg2ANW9mAUHVKuc26z x3X6TVPz+CSzqg5KGMaVtULuwED6Cjac81RamQeiw+chGwjYWdbJF1wWcLiuk48dl0tl BFo/7Qc1COsNYamfPutukLG7J3vOGZy4wz+AQRIK2BHophVfy7oBEAaP3CwLmqRgT4Qn drCBEgLkdH3NRnZ5CoVSPL+QZkLnAtsfJA49P8rDSM9QK/MzsR+/tQO3o2mbcNp1nUTC 7wz9S2qoZTDTSoYgJdYKOCH9DezQjKXrNiId3BrzMIUfV4OUyl2AYFrkIWwTEGq6A3Jh P1pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=DrwXN0lnZyEtNP7fSC4yp+Ct1fvcLFammFPrQ18DXiU=; b=BRMzXqhPHZxQH44gUR0aduePymbxnP03dpLBxBVEiom04pl1gMYvJODJ6im+unPHsu 2GNdHveGIIdEsEBF3zdjUFMs6mdSvkItfVAmHrmqAx4R/v5x/2ebPvM/t3x1XpToLk8Y zc66BxaRuoCDoBN76CFoTR1pkks9q9a4Sz5vo07rfitmUDvhHmfP3ZxmYHF/RWPeMARt eo4tMSO3HxEcPt/MXeH0eeAdbCxoyWvCWp73Epjte/VjPO1tfVKDICBkEm3gps9Ynyf8 DRKbBgxxtnvmUUTEHK46T9szZ16uq+LzeIfUK77mVHDKqKDA0QN2akqQ0IR5HLeK9v4b pOOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aT4rFPL3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c2-v6si3170992pfn.212.2018.07.26.23.59.55; Fri, 27 Jul 2018 00:00:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aT4rFPL3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729528AbeG0IT1 (ORCPT + 99 others); Fri, 27 Jul 2018 04:19:27 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45012 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbeG0IT0 (ORCPT ); Fri, 27 Jul 2018 04:19:26 -0400 Received: by mail-pg1-f194.google.com with SMTP id r1-v6so2673874pgp.11 for ; Thu, 26 Jul 2018 23:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DrwXN0lnZyEtNP7fSC4yp+Ct1fvcLFammFPrQ18DXiU=; b=aT4rFPL3h0GatvLWd+ohi264DviSusYKUGzA8hJpwKgPh+8i/zw67M4gidXsNuiziW InqVNlQkmPSqFcxVTBdfQy6Ax4q9TZvW5ALqhdBMpTIlfbCzVFynJdPZ1KCzEeEN+/pW yqKONhYfJgoXPKE9J4aljOyPu8Pw6oaJRFo0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=DrwXN0lnZyEtNP7fSC4yp+Ct1fvcLFammFPrQ18DXiU=; b=K6ouO3Y2as7iC3ZTpMU+ysehDoAlkHy2I9L0Rp7pKKBzfvyIS93XnaUE5DTvxEiMwK SCdxN4A/F9rUki990Yl0rU3dvgDvKHAxnEPrRXiI2kgL4cDSiZqNwc9icgpuiKCpgv8J MOEbSuZYdUYJxdFJVfSas8RCiUDaSI0Jy2OpOu1UB1p+F9sE/fBmT55DQj+qyYaQTio8 s2+MHMbX2QN28T7xTliJG31iVR0tWEadg9aucT433tJ/7rBL+d857/qLmegy9Uw3GoTR bJaIG+7CeipozpLmAdn5lecheM/bCcMVjp01wb8yBr6CyPmN9BK3GtEBHPuDPgdzIgvf 66Sg== X-Gm-Message-State: AOUpUlERxrMXerxZ1+tS45sPXcSdM8+9R7Yn/nZ1/4E9G0ux7VEwpbOY 1zGwO8hqj7nOSiHkZMZvCf4H/Q== X-Received: by 2002:a65:5106:: with SMTP id f6-v6mr4857600pgq.72.1532674737769; Thu, 26 Jul 2018 23:58:57 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id z19-v6sm5119055pgi.33.2018.07.26.23.58.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 23:58:57 -0700 (PDT) Date: Fri, 27 Jul 2018 16:00:31 +0900 From: AKASHI Takahiro To: James Morse Cc: catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 12/16] arm64: kexec_file: add crash dump support Message-ID: <20180727070030.GG11258@linaro.org> Mail-Followup-To: AKASHI Takahiro , James Morse , catalin.marinas@arm.com, will.deacon@arm.com, dhowells@redhat.com, vgoyal@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net, dyoung@redhat.com, bhe@redhat.com, arnd@arndb.de, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, ard.biesheuvel@linaro.org, bhsharma@redhat.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20180724065759.19186-1-takahiro.akashi@linaro.org> <20180724065759.19186-13-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 26, 2018 at 02:36:58PM +0100, James Morse wrote: > Hi Akashi, > > On 24/07/18 07:57, AKASHI Takahiro wrote: > > Enabling crash dump (kdump) includes > > * prepare contents of ELF header of a core dump file, /proc/vmcore, > > using crash_prepare_elf64_headers(), and > > * add two device tree properties, "linux,usable-memory-range" and > > "linux,elfcorehdr", which represent respectively a memory range > > to be used by crash dump kernel and the header's location > > > diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h > > index 5d102a1054b3..1b2c27026ae0 100644 > > --- a/arch/arm64/include/asm/kexec.h > > +++ b/arch/arm64/include/asm/kexec.h > > @@ -97,8 +97,12 @@ static inline void crash_post_resume(void) {} > > #define ARCH_HAS_KIMAGE_ARCH > > > > struct kimage_arch { > > > - void *dtb_buf; > > + void *dtb; > > This change should be in an earlier patch, otherwise this series doesn't build > during bisect. Will fix. > With the build-issues fixed: > Reviewed-by: James Morse > > Some boring Nits: > > > unsigned long dtb_mem; > > + /* Core ELF header buffer */ > > + void *elf_headers; > > + unsigned long elf_headers_mem; > > + unsigned long elf_headers_sz; > > }; > > diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c > > index b8297f10e2ef..7356da5a53d5 100644 > > --- a/arch/arm64/kernel/machine_kexec_file.c > > +++ b/arch/arm64/kernel/machine_kexec_file.c > > @@ -38,12 +44,30 @@ static int setup_dtb(struct kimage *image, > > void **dtb_buf, unsigned long *dtb_buf_len) > > { > > void *buf = NULL; > > - size_t buf_size; > > + size_t buf_size, range_size; > > int nodeoffset; > > int ret; > > > > /* duplicate dt blob */ > > buf_size = fdt_totalsize(initial_boot_params); > > + range_size = of_fdt_reg_cells_size(); > > + > > + if (image->type == KEXEC_TYPE_CRASH) { > > + buf_size += fdt_prop_len("linux,elfcorehdr", range_size); > > + buf_size += fdt_prop_len("linux,usable-memory-range", > > + range_size); > > + } > > Nit: it would be better if these strings were defined in a header file somewhere > so we don't risk a typo if this gets refactored. Nit?? Well, I do understand your concern, but it's a bit headache. If we handle them in such a way, we may want to handle others, such as linux,initrd-start/end, chosen and bootargs, as well in this file. They are not kexec specific and should go into a common header. This will end up propagating similar changes to other no-kexec-related occurrences under drivers/of. So I want to keep the following def's local in this file for easy maintenance. #define FDT_PSTR_KEXEC_ELFHDR "linux,elfcorehdr" #define FDT_PSTR_MEM_RANGE "linux,usable-memory-range" #define FDT_PSTR_INITRD_ST "linux,initrd-start" #define FDT_PSTR_INITRD_END "linux,initrd-end" #define FDT_PSTR_BOOTARGS "bootargs" #define FDT_PSTR_KASLR_SEED "kaslr-seed" > > > > @@ -129,6 +170,43 @@ static int setup_dtb(struct kimage *image, > > return ret; > > } > > > > +static int prepare_elf_headers(void **addr, unsigned long *sz) > > +{ > > + struct crash_mem *cmem; > > + unsigned int nr_ranges; > > + int ret; > > + u64 i; > > + phys_addr_t start, end; > > + > > + nr_ranges = 1; /* for exclusion of crashkernel region */ > > > + for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, 0, > > + &start, &end, NULL) > > Nit: MEMBLOCK_NONE OK -Takahiro AKASHI > > Thanks, > > James