Skip to contentSkip to conversation

mm/mm_init: Ignore kernelcore=mirror boot option when no mirror memory presents.

PATCH New Levi Yun 1 participant 1 message Aug 2, 2023

Subsystems (2)
lore
Share & tools
lore

Levi Yun

author
#0 lore raw

PATCH 1/1 mm/mm_init: Ignore kernelcore=mirror boot option when no mirror memory presents.

In the machine where no mirror memory is set, All memory region in ZONE_NORMAL is used as ZONE_MOVABLE when kernelcore=mirror boot option is used.
So, ZONE_NORMAL couldn't be populated properly because all of ZONE_NORMAL pages is absent.

To avoid this abnormal situation,
ignore disable kernelcore=mirror option when no mirror memory is found.

---
 mm/mm_init.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
mm/mm_init.c +10 -1
index a1963c3322af..4c180ef1a993 100644
@@ -376,10 +376,13 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 	 */
 	if (mirrored_kernelcore) {
 		bool mem_below_4gb_not_mirrored = false;
+		bool no_mirror_mem = true;
 
 		for_each_mem_region(r) {
-			if (memblock_is_mirror(r))
+			if (memblock_is_mirror(r)) {
+				no_mirror_mem = false;
 				continue;
+			}
 
 			nid = memblock_get_region_node(r);
 
@@ -398,6 +401,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 		if (mem_below_4gb_not_mirrored)
 			pr_warn("This configuration results in unmirrored kernel memory.\n");
 
+		if (no_mirror_mem) {
+			pr_warn("There is no mirrored memory. Ignore kernelcore=mirror.\n");
+			mirrored_kernelcore = false;
+			memset(zone_movable_pfn, 0x00, sizeof(zone_movable_pfn));
+		}
+
 		goto out2;
 	}
 
Signature · 1 line
2.37.2