Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp458596imm; Thu, 26 Jul 2018 06:38:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpddET0HbfU0l2IIW0gj1rc8Meu6YgX+POD/LCRthrZGNG0pg7O9YjsPuZQWsD4kN3FgDfwe X-Received: by 2002:a62:f909:: with SMTP id o9-v6mr2175618pfh.141.1532612320605; Thu, 26 Jul 2018 06:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532612320; cv=none; d=google.com; s=arc-20160816; b=aB7DkGPVkj0ni3Hr1L4vqI/RJbA05I5s9rQRmPKlfcaWHCN2WopxwUEa06ItVNG2T8 U2Ed5VYObYWouMAsTT9lI1HDuXhvamuUsPxnbWtBpTTTX/i0T6vb9M7CZDMee1Qvd7nJ Pv0uZFasEmj81jvgsR+NLPaeWz3L7nb1qoJovtqhSSgvxs2IxLa+9M7SgJOw1LCDhsRa hZpGkG1Uu5f4aoFb/g5dYc6UNEV6BHD9W1avmw1er/jSBvkswXd216fIDCPeMCNaQxof njGnNSPeKJMW/3fb1lvifC2x/SL+sNkXQEtgbNxcUV+uy1QydXoQf5MGds26pVhWBhFs pTpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=lPbSpw1Ih0Ml50gna+zhzgMTmjEA1Iwm2OvlyTgEf3A=; b=Zq0yRkeundiJNVIPQDOmbpEocBYGz7d2P4+1dRjKIV+P4pnPMc+oF/wE3WBCLBc6sP t8DgSgeMVHLULNjQLTdeiSRxp8oJ1E9H+2oeVMmsTkzwS7J+d7Y9cpcwGoYhvmQIi1so kjq+gsoKps4C9F8Db2xHW7hilC4UlnMJV36LVdM61mjA7jdUnGksciK/RIm0Aq65HpL+ cDxnsyB6oE11DQ1iDSSxrgPVCgrO9DA+lwyfRUNP6rQ/FdRRFPspDGK3NoO2jk+960R0 f3AK0Hemz1eNN/kTcXIPaTaKdQW84LofAL1tFmAMxP/WQk04HmNQNQXe8/X1Yc3xk6uL tb8Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13-v6si1342051pgh.642.2018.07.26.06.38.25; Thu, 26 Jul 2018 06:38:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730379AbeGZOx5 (ORCPT + 99 others); Thu, 26 Jul 2018 10:53:57 -0400 Received: from foss.arm.com ([217.140.101.70]:56038 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729410AbeGZOx5 (ORCPT ); Thu, 26 Jul 2018 10:53:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 355C615A2; Thu, 26 Jul 2018 06:37:02 -0700 (PDT) Received: from [10.4.12.81] (melchizedek.emea.arm.com [10.4.12.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B6E83F6A8; Thu, 26 Jul 2018 06:36:59 -0700 (PDT) Subject: Re: [PATCH v12 12/16] arm64: kexec_file: add crash dump support To: AKASHI Takahiro 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 References: <20180724065759.19186-1-takahiro.akashi@linaro.org> <20180724065759.19186-13-takahiro.akashi@linaro.org> From: James Morse Message-ID: Date: Thu, 26 Jul 2018 14:36:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180724065759.19186-13-takahiro.akashi@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. > @@ -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 Thanks, James