From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [v2 1/5] arm64: kdump: reserve memory for crash dump kernel
Date: Fri, 24 Apr 2015 11:11:36 +0100 [thread overview]
Message-ID: <20150424101136.GE29183@leverpostej> (raw)
In-Reply-To: <1429861989-8417-2-git-send-email-takahiro.akashi@linaro.org>
On Fri, Apr 24, 2015 at 08:53:04AM +0100, AKASHI Takahiro wrote:
> On system kernel, the memory region used by crash dump kernel must be
> specified by "crashkernel=X at Y" boot parameter. reserve_crashkernel()
> will allocate the region in "System RAM" and reserve it for later use.
>
> On crash dump kernel, memory region information in system kernel is
> described in a specific region specified by "elfcorehdr=X at Y" boot parameter.
> reserve_elfcorehdr() will set aside the region to avoid data destruction
> by the kernel.
>
> Crash dump kernel will access memory regions in system kernel via
> copy_oldmem_page(), which reads a page by ioremap'ing it assuming that
> such pages are not part of main memory of crash dump kernel.
> This is true under non-UEFI environment because kexec-tools modifies
> a device tree adding "usablemem" attributes to memory sections.
I'm not sure what you mean by "usablemem" here.
Do you just mean that the memory nodes are altered such that they only
cover memory usable by the crash kernel?
Why not _always_ require a command line argument for the crash kernel
that restricts its memory usage to a particular range? That way it
doesn't matter whether we're using UEFI or not.
> Under UEFI, however, this is not true because UEFI remove memory sections
> in a device tree and export all the memory regions, even though they belong
> to system kernel.
>
> So we should add "mem=X[MG]" boot parameter to limit the memory size and
> avoid hitting the following assertion in ioremap():
> if (WARN_ON(pfn_valid(__phys_to_pfn(phys_addr))))
> return NULL;
That looks suspicious. What is being ioremapped at that point?
[...]
> @@ -393,6 +398,7 @@ void __init setup_arch(char **cmdline_p)
> local_async_enable();
>
> efi_init();
> +
> arm64_memblock_init();
>
> paging_init();
Nit: unrelated whitespace change.
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index ae85da6..ea70d41 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -34,6 +34,8 @@
> #include <linux/dma-contiguous.h>
> #include <linux/efi.h>
> #include <linux/swiotlb.h>
> +#include <linux/kexec.h>
> +#include <linux/crash_dump.h>
Nit: please keep these ordered.
[...]
> + if (memblock_reserve(crash_base, crash_size)) {
> + pr_warn("crashkernel reservation failed - out of memory\n");
> + return;
> + }
If we can remove this memory rather than reserving it, we can limit the
first kernel's ability to accidentally clobber the crash kernel, at the
expense of having to explicitly map/unmap around loading it.
Mark.
next prev parent reply other threads:[~2015-04-24 10:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 7:53 [v2 0/5] arm64: add kdump support AKASHI Takahiro
2015-04-24 7:53 ` [v2 1/5] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro
2015-04-24 10:11 ` Mark Rutland [this message]
2015-05-11 6:44 ` AKASHI Takahiro
2015-04-28 9:19 ` Baoquan He
2015-05-11 7:38 ` AKASHI Takahiro
2015-05-11 7:54 ` Baoquan He
2015-05-11 8:17 ` AKASHI Takahiro
2015-05-11 9:41 ` Baoquan He
2015-05-12 7:32 ` AKASHI Takahiro
2015-04-24 7:53 ` [v2 2/5] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2015-04-24 10:39 ` Mark Rutland
2015-04-24 10:43 ` Marc Zyngier
2015-08-06 7:09 ` AKASHI Takahiro
2015-08-06 15:51 ` Marc Zyngier
2015-08-07 4:24 ` AKASHI Takahiro
2015-05-11 7:10 ` AKASHI Takahiro
2015-05-22 5:56 ` AKASHI Takahiro
2015-04-24 7:53 ` [v2 3/5] arm64: kdump: do not go into EL2 before starting a crash dump kernel AKASHI Takahiro
2015-04-24 7:53 ` [v2 4/5] arm64: add kdump support AKASHI Takahiro
2015-05-08 12:19 ` Dave Young
2015-05-11 7:47 ` Dave Young
2015-05-11 7:58 ` AKASHI Takahiro
2015-05-11 8:39 ` Dave Young
2015-04-24 7:53 ` [v2 5/5] arm64: enable kdump in the arm64 defconfig AKASHI Takahiro
2015-04-24 9:53 ` [v2 0/5] arm64: add kdump support Mark Rutland
2015-05-11 6:16 ` AKASHI Takahiro
2015-05-12 5:43 ` Dave Young
2015-05-18 8:08 ` 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=20150424101136.GE29183@leverpostej \
--to=mark.rutland@arm.com \
--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