[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-b9ac3849af412fd3887d7652bdbabf29d2aecc16@git.kernel.org>
Date: Mon, 22 Apr 2019 01:28:59 -0700
From: tip-bot for Dave Young <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: corbet@....net, gregkh@...uxfoundation.org, konrad.wilk@...cle.com,
bp@...e.de, paulmck@...ux.ibm.com, jkosina@...e.cz,
okaya@...eaurora.org, jgross@...e.com, hpa@...or.com,
linuxram@...ibm.com, thymovanbeers@...il.com, x86@...nel.org,
kookoo.gu@...el.com, ptesarik@...e.cz, mingo@...hat.com,
mingo@...nel.org, linux-kernel@...r.kernel.org,
ebiederm@...ssion.com, yinghai@...nel.org, dhowells@...hat.com,
bhe@...hat.com, tglx@...utronix.de, keescook@...omium.org,
dyoung@...hat.com
Subject: [tip:x86/kdump] x86/kdump: Fall back to reserve high crashkernel
memory
Commit-ID: b9ac3849af412fd3887d7652bdbabf29d2aecc16
Gitweb: https://git.kernel.org/tip/b9ac3849af412fd3887d7652bdbabf29d2aecc16
Author: Dave Young <dyoung@...hat.com>
AuthorDate: Mon, 22 Apr 2019 11:19:05 +0800
Committer: Borislav Petkov <bp@...e.de>
CommitDate: Mon, 22 Apr 2019 10:23:05 +0200
x86/kdump: Fall back to reserve high crashkernel memory
crashkernel=xM tries to reserve memory for the crash kernel under 4G,
which is enough, usually. But this could fail sometimes, for example
when one tries to reserve a big chunk like 2G, for example.
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 allocates extra low memory for DMA buffers and swiotlb, and
this is not always necessary for all machines.
Typically, crashkernel=128M usually works with low reservation under 4G,
so keep <4G as default.
[ bp: Massage. ]
Signed-off-by: Dave Young <dyoung@...hat.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Reviewed-by: Ingo Molnar <mingo@...nel.org>
Acked-by: Baoquan He <bhe@...hat.com>
Cc: Dave Young <dyoung@...hat.com>
Cc: David Howells <dhowells@...hat.com>
Cc: Eric Biederman <ebiederm@...ssion.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Jiri Kosina <jkosina@...e.cz>
Cc: Jonathan Corbet <corbet@....net>
Cc: Juergen Gross <jgross@...e.com>
Cc: Kees Cook <keescook@...omium.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc: linux-doc@...r.kernel.org
Cc: "Paul E. McKenney" <paulmck@...ux.ibm.com>
Cc: Petr Tesarik <ptesarik@...e.cz>
Cc: piliu@...hat.com
Cc: Ram Pai <linuxram@...ibm.com>
Cc: Sinan Kaya <okaya@...eaurora.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Thymo van Beers <thymovanbeers@...il.com>
Cc: vgoyal@...hat.com
Cc: x86-ml <x86@...nel.org>
Cc: Yinghai Lu <yinghai@...nel.org>
Cc: Zhimin Gu <kookoo.gu@...el.com>
Link: https://lkml.kernel.org/r/20190422031905.GA8387@dhcp-128-65.nay.redhat.com
---
Documentation/admin-guide/kernel-parameters.txt | 7 +++++--
arch/x86/kernel/setup.c | 22 ++++++++++++++--------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2b8ee90bb644..24d01648edeb 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/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 '@...set' 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
+ fall back to reserve region above 4G when '@...set'
+ hasn't been specified.
+ See Documentation/kdump/kdump.txt for further details.
crashkernel=range1:size1[,range2:size2,...][@offset]
[KNL] Same as above, but depends on the memory
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index daf7c5650c18..c15f362a2516 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -541,21 +541,27 @@ static void __init reserve_crashkernel(void)
}
/* 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.
+ * crashkernel=x,high reserves memory over 4G, also allocates
+ * 256M extra low memory for DMA buffers and swiotlb.
+ * But the extra memory is not required for all machines.
+ * So try low memory first and fall back 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;
Powered by blists - more mailing lists