Linux-mm Archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/mm_init: Ignore kernelcore=mirror boot option when no mirror memory presents.
@ 2023-08-02 18:36 Levi Yun
  0 siblings, 0 replies; only message in thread
From: Levi Yun @ 2023-08-02 18:36 UTC (permalink / raw
  To: rppt, akpm; +Cc: linux-mm, linux-kernel, Levi Yun

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.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
 mm/mm_init.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/mm/mm_init.c b/mm/mm_init.c
index a1963c3322af..4c180ef1a993 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -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;
 	}
 
-- 
2.37.2



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-02 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 18:36 [PATCH] mm/mm_init: Ignore kernelcore=mirror boot option when no mirror memory presents Levi Yun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).