Thread (29 messages) 29 messages, 3 authors, 2022-01-07
STALE1610d
Revisions (8)
  1. v15 [diff vs current]
  2. v16 [diff vs current]
  3. v17 [diff vs current]
  4. v18 current
  5. v19 [diff vs current]
  6. v22 [diff vs current]
  7. v23 [diff vs current]
  8. v24 [diff vs current]

[PATCH v18 06/17] x86/setup: Update comments in reserve_crashkernel()

From: Zhen Lei <hidden>
Date: 2021-12-22 13:12:46
Also in: kexec, linux-devicetree, linux-doc, lkml
Subsystem: the rest, x86 architecture (32-bit and 64-bit) · Maintainers: Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen

Add comments to describe which bootup parameters are processed by the
code, and make comments close to the code being commented.

Signed-off-by: Zhen Lei <redacted>
---
 arch/x86/kernel/setup.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 07a58313db5c5f7..52aa925877ca787 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -485,20 +485,20 @@ static void __init reserve_crashkernel(void)
 	if (flag == CRASHKERNEL_MEM_NONE)
 		return;
 
-	/* 0 means: find the address automatically */
 	if (!crash_base) {
 		/*
-		 * Set CRASH_ADDR_LOW_MAX upper bound for crash memory,
-		 * 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.
+		 * For the case of crashkernel=X[@offset] and offset is omitted,
+		 * try the low memory first.
 		 */
 		if (!(flag & CRASHKERNEL_MEM_HIGH))
 			crash_base = memblock_phys_alloc_range(crash_size,
 						CRASH_ALIGN, CRASH_ALIGN,
 						CRASH_ADDR_LOW_MAX);
+
+		/*
+		 * If low memory allocation failed above, or for the case of
+		 * crashkernel=X,high, try the high memory.
+		 */
 		if (!crash_base)
 			crash_base = memblock_phys_alloc_range(crash_size,
 						CRASH_ALIGN, CRASH_ALIGN,
@@ -510,6 +510,10 @@ static void __init reserve_crashkernel(void)
 	} else {
 		unsigned long long start;
 
+		/*
+		 * The case of crashkernel=X@offset and offset is specified.
+		 * Only user-specified space can be reserved.
+		 */
 		start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base,
 						  crash_base + crash_size);
 		if (start != crash_base) {
@@ -520,6 +524,10 @@ static void __init reserve_crashkernel(void)
 
 #ifdef CONFIG_X86_64
 	if (crash_base >= (1ULL << 32)) {
+		/*
+		 * Ensure that at least 256M extra low memory is allocated for
+		 * DMA buffers and swiotlb, if low memory size is not specified.
+		 */
 		if (!(flag & CRASHKERNEL_MEM_LOW)) {
 			/*
 			 * two parts from kernel/dma/swiotlb.c:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help