From: takahiro.akashi@linaro.org (AKASHI Takahiro)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v31 03/12] arm64: kdump: reserve memory for crash dump kernel
Date: Thu, 2 Feb 2017 13:52:36 +0900 [thread overview]
Message-ID: <20170202045235.GB13549@linaro.org> (raw)
In-Reply-To: <20170201152609.GE4756@leverpostej>
On Wed, Feb 01, 2017 at 03:26:09PM +0000, Mark Rutland wrote:
> Hi,
>
> On Wed, Feb 01, 2017 at 09:46:22PM +0900, AKASHI Takahiro wrote:
> > +#ifdef CONFIG_KEXEC_CORE
> > +/*
> > + * reserve_crashkernel() - reserves memory for crash kernel
> > + *
> > + * This function reserves memory area given in "crashkernel=" kernel command
> > + * line parameter. The memory reserved is used by dump capture kernel when
> > + * primary kernel is crashing.
> > + */
> > +static void __init reserve_crashkernel(void)
> > +{
> > + unsigned long long crash_base, crash_size;
> > + int ret;
> > +
> > + ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
> > + &crash_size, &crash_base);
> > + /* no crashkernel= or invalid value specified */
> > + if (ret || !crash_size)
> > + return;
> > +
> > + crash_size = PAGE_ALIGN(crash_size);
> > +
> > + if (crash_base == 0) {
> > + /* Current arm64 boot protocol requires 2MB alignment */
> > + crash_base = memblock_find_in_range(0, ARCH_LOW_ADDRESS_LIMIT,
> > + crash_size, SZ_2M);
> > + if (crash_base == 0) {
> > + pr_warn("Unable to allocate crashkernel (size:%llx)\n",
> > + crash_size);
>
> Nit: can we please make that "size: 0x%llx", so that it's always clearly
> a hex number? e.g.
>
> pr_warn("cannot allocate 0x%llx bytes for crashkernel\n",
> crash_size);
OK
> > + return;
> > + }
> > + } else {
> > + /* User specifies base address explicitly. */
> > + if (!memblock_is_region_memory(crash_base, crash_size) ||
> > + memblock_is_region_reserved(crash_base, crash_size)) {
> > + pr_warn("crashkernel has wrong address or size\n");
> > + return;
> > + }
>
> To better report the error, can we please split these up:
>
> if (!memblock_is_region_memory(crash_base, crash_size)) {
> pr_warn("cannot reserve crashkernel: region is not memory\n");
> return;
> }
>
> if (!memblock_is_region_memory(crash_base, crash_size)) {
> pr_warn("cannot reserve crashkernel: region overlaps reserved memory\n");
> return;
> }
OK, and
> > + if (!IS_ALIGNED(crash_base, SZ_2M)) {
> > + pr_warn("crashkernel base address is not 2MB aligned\n");
pr_warn("cannot reserve crashkernel: base address is not 2MB aligned\n");
> > + return;
> > + }
> > + }
> > + memblock_reserve(crash_base, crash_size);
> > +
> > + pr_info("Reserving %lldMB of memory at %lldMB for crashkernel\n",
> > + crash_size >> 20, crash_base >> 20);
>
> We only page-align the size, so the MB will be a little off, but that's
> probably OK. However, it would also be nicer to log the base as an
> address.
You might notice that the exact same message is used by all the other
architectures, but
> Could we dump this as we do for the kernel memory layout? e.g.
>
> pr_info("crashkernel reserved: 0x%016lx - 0x%016lx (%lld MB)\n",
> crash_base, crash_base + crash_size, crash_size >> 20);
We can go either way.
> With those:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
-Takahiro AKASHI
> Thanks,
> Mark.
next prev parent reply other threads:[~2017-02-02 4:52 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 12:42 [PATCH v31 00/12] add kdump support AKASHI Takahiro
2017-02-01 12:45 ` [PATCH v31 01/12] memblock: add memblock_cap_memory_range() AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 02/12] arm64: limit memory regions based on DT property, usable-memory-range AKASHI Takahiro
2017-02-01 15:07 ` Mark Rutland
2017-02-02 4:21 ` AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 03/12] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro
2017-02-01 15:26 ` Mark Rutland
2017-02-02 4:52 ` AKASHI Takahiro [this message]
2017-02-02 11:26 ` Mark Rutland
2017-02-02 13:44 ` AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 04/12] arm64: mm: allow for unmapping part of kernel mapping AKASHI Takahiro
2017-02-01 16:03 ` Mark Rutland
2017-02-02 10:21 ` AKASHI Takahiro
2017-02-02 11:44 ` Mark Rutland
2017-02-02 14:01 ` AKASHI Takahiro
2017-02-02 14:35 ` Mark Rutland
2017-02-02 14:55 ` AKASHI Takahiro
2017-02-03 6:13 ` AKASHI Takahiro
2017-02-03 14:22 ` Mark Rutland
2017-02-01 12:46 ` [PATCH v31 05/12] arm64: kdump: protect crash dump kernel memory AKASHI Takahiro
2017-02-01 18:00 ` Mark Rutland
2017-02-01 18:25 ` Mark Rutland
2017-02-02 10:39 ` AKASHI Takahiro
2017-02-02 11:54 ` Mark Rutland
2017-02-03 1:45 ` AKASHI Takahiro
2017-02-03 11:51 ` Mark Rutland
2017-02-02 10:45 ` James Morse
2017-02-02 11:19 ` AKASHI Takahiro
2017-02-02 11:48 ` Mark Rutland
2017-02-02 10:31 ` AKASHI Takahiro
2017-02-02 11:16 ` Mark Rutland
2017-02-02 14:36 ` AKASHI Takahiro
2017-02-02 15:36 ` Mark Rutland
2017-02-01 12:46 ` [PATCH v31 06/12] arm64: hibernate: preserve kdump image around hibernation AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 07/12] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 08/12] arm64: kdump: add VMCOREINFO's for user-space tools AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 09/12] arm64: kdump: provide /proc/vmcore file AKASHI Takahiro
2017-02-01 19:21 ` Mark Rutland
2017-02-02 6:24 ` AKASHI Takahiro
2017-02-02 12:03 ` Mark Rutland
2017-02-02 12:08 ` Mark Rutland
2017-02-02 14:39 ` AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 10/12] arm64: kdump: enable kdump in defconfig AKASHI Takahiro
2017-02-01 12:46 ` [PATCH v31 11/12] Documentation: kdump: describe arm64 port AKASHI Takahiro
2017-02-01 12:48 ` [PATCH v31 12/12] Documentation: dt: chosen properties for arm64 kdump AKASHI Takahiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170202045235.GB13549@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).