[PATCH 2/2] powerpc/fadump: Do not use hugepages when fadump is active

Hari Bathini hbathini at linux.vnet.ibm.com
Thu Apr 5 03:13:54 AEST 2018


FADump capture kernel boots in a restricted memory environment saving the
context of previous kernel to capture vmcore. Having hugepages support in
such environment would make things unnecessarily complicated, as hugepages
need memory set aside for them and this would mean too much memory wasted
in supporting hugepages in capture kernel. Also, if there is a shortfall
in memory, capture kernel fails to boot. So, disable hugepages when fadump
is active to avoid boot issues in FADump capture kernel.

Signed-off-by: Hari Bathini <hbathini at linux.vnet.ibm.com>
---
 arch/powerpc/mm/hash_utils_64.c |   11 +++++++++--
 arch/powerpc/mm/hugetlbpage.c   |   11 +++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index cf290d41..703cde2 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -571,8 +571,15 @@ static void __init htab_scan_page_sizes(void)
 	}
 
 #ifdef CONFIG_HUGETLB_PAGE
-	/* Reserve 16G huge page memory sections for huge pages */
-	of_scan_flat_dt(htab_dt_scan_hugepage_blocks, NULL);
+	/*
+	 * FADump capture kernel doesn't care much about hugepages.
+	 * Moreover, handling hugepages in capture kernel is asking
+	 * for trouble. So, skip this when fadump is active.
+	 */
+	if (!is_fadump_active()) {
+		/* Reserve 16G huge page memory sections for huge pages */
+		of_scan_flat_dt(htab_dt_scan_hugepage_blocks, NULL);
+	}
 #endif /* CONFIG_HUGETLB_PAGE */
 }
 
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 876da2b..3d47fb6 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -23,6 +23,7 @@
 #include <asm/pgalloc.h>
 #include <asm/tlb.h>
 #include <asm/setup.h>
+#include <asm/fadump.h>
 #include <asm/hugetlb.h>
 #include <asm/pte-walk.h>
 
@@ -653,6 +654,16 @@ static int __init hugetlbpage_init(void)
 {
 	int psize;
 
+	/*
+	 * FADump capture kernel doesn't care much about hugepages.
+	 * Moreover, handling hugepages in capture kernel is asking
+	 * for trouble. So, skip this when fadump is active.
+	 */
+	if (is_fadump_active()) {
+		pr_info("Huge pages are not supported when fadump is active\n");
+		return 0;
+	}
+
 #if !defined(CONFIG_PPC_FSL_BOOK3E) && !defined(CONFIG_PPC_8xx)
 	if (!radix_enabled() && !mmu_has_feature(MMU_FTR_16M_PAGE))
 		return -ENODEV;



More information about the Linuxppc-dev mailing list