From: Dave Young <dyoung@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, linux-kernel@vger.kernel.org, vgoyal@redhat.com,
bhe@redhat.com, piliu@redhat.com, Yinghai Lu <yinghai@kernel.org>,
Eric Biederman <ebiederm@xmission.com>
Subject: [PATCH 2/2] X86/kdump: fall back to reserve high crashkernel memory
Date: Sun, 21 Apr 2019 11:51:00 +0800 [thread overview]
Message-ID: <20190421035303.669870129@redhat.com> (raw)
In-Reply-To: 20190421035058.943630505@redhat.com
crashkernel=xM tries to reserve crashkernel memory under 4G, which
is enough for usual cases. But this could fail sometimes, for example
one tries to reserve a big chunk like 2G, it is possible to fail.
So let the crashkernel=xM just fall back to use high memory in case it
fails to find a suitable low range. Do not set the ,high as default
because it allocs extra low memory for DMA buffers and swiotlb, this is
not always necessary for all machines. Typically like crashkernel=128M
usually work with low reservation under 4G, so still keep <4G as default.
Signed-off-by: Dave Young <dyoung@redhat.com>
---
Documentation/admin-guide/kernel-parameters.txt | 7 +++++--
arch/x86/kernel/setup.c | 22 ++++++++++++++--------
2 files changed, 19 insertions(+), 10 deletions(-)
--- linux-x86.orig/arch/x86/kernel/setup.c
+++ linux-x86/arch/x86/kernel/setup.c
@@ -541,21 +541,27 @@ static void __init reserve_crashkernel(v
}
/* 0 means: find the address automatically */
- if (crash_base <= 0) {
+ if (!crash_base) {
/*
* Set CRASH_ADDR_LOW_MAX upper bound for crash memory,
- * as old kexec-tools loads bzImage below that, unless
- * "crashkernel=size[KMG],high" is specified.
+ * as crashkernel=x,high allocs memory over 4G, also allocs
+ * 256M extra low memory for DMA buffers and swiotlb.
+ * but the extra memory is not required for all machines.
+ * So prefer low memory first, and fallback to high memory
+ * unless "crashkernel=size[KMG],high" is specified.
*/
- crash_base = memblock_find_in_range(CRASH_ALIGN,
- high ? CRASH_ADDR_HIGH_MAX
- : CRASH_ADDR_LOW_MAX,
- crash_size, CRASH_ALIGN);
+ if (!high)
+ crash_base = memblock_find_in_range(CRASH_ALIGN,
+ CRASH_ADDR_LOW_MAX,
+ crash_size, CRASH_ALIGN);
+ if (!crash_base)
+ crash_base = memblock_find_in_range(CRASH_ALIGN,
+ CRASH_ADDR_HIGH_MAX,
+ crash_size, CRASH_ALIGN);
if (!crash_base) {
pr_info("crashkernel reservation failed - No suitable area found.\n");
return;
}
-
} else {
unsigned long long start;
--- linux-x86.orig/Documentation/admin-guide/kernel-parameters.txt
+++ linux-x86/Documentation/admin-guide/kernel-parameters.txt
@@ -704,8 +704,11 @@
upon panic. This parameter reserves the physical
memory region [offset, offset + size] for that kernel
image. If '@offset' is omitted, then a suitable offset
- is selected automatically. Check
- Documentation/kdump/kdump.txt for further details.
+ is selected automatically.
+ [KNL, x86_64] select a region under 4G first, and
+ fallback to reserve region above 4G in case without
+ '@offset'.
+ See Documentation/kdump/kdump.txt for further details.
crashkernel=range1:size1[,range2:size2,...][@offset]
[KNL] Same as above, but depends on the memory
next prev parent reply other threads:[~2019-04-21 3:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-21 3:50 [PATCH 1/2] X86/kdump: move crashkernel=X to reserve under 4G by default Dave Young
2019-04-21 3:51 ` Dave Young [this message]
2019-04-21 18:26 ` [PATCH 2/2] X86/kdump: fall back to reserve high crashkernel memory Ingo Molnar
2019-04-22 3:03 ` Dave Young
2019-04-22 3:19 ` [PATCH 2/2 update] " Dave Young
2019-04-22 3:29 ` Baoquan He
2019-04-22 8:28 ` [tip:x86/kdump] x86/kdump: Fall " tip-bot for Dave Young
2019-04-21 18:24 ` [PATCH 1/2] X86/kdump: move crashkernel=X to reserve under 4G by default Ingo Molnar
2019-04-22 8:28 ` [tip:x86/kdump] x86/kdump: Have crashkernel=X " tip-bot for Dave Young
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=20190421035303.669870129@redhat.com \
--to=dyoung@redhat.com \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=piliu@redhat.com \
--cc=tglx@linutronix.de \
--cc=vgoyal@redhat.com \
--cc=x86@kernel.org \
--cc=yinghai@kernel.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