Skip to contentSkip to conversation

powerpc/mm: Fix panic on boot with 4K page size

PATCH New Aneesh Kumar K.V 1 participant 1 message Dec 14, 2016 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/mm: Fix panic on boot with 4K page size

For transparent hugepage config, we need to use double the size of the pmd. Hence we should use PMD_CACHE_INDEX when allocating pagetable cache. For all configs other than book3s 64k this value is same as PMD_INDEX_SIZE. With 4k, since we don't support transparent hugepage in hash mode, we can use PMD_INDEX_SIZE even though CONFIG_TRANSPARENT_HUGEPAGE is defined. With book3s 4k THP is only supported in radix mode.

Fixes "powerpc: port 64 bits pgtable_cache to 32 bits"
---
 arch/powerpc/include/asm/book3s/64/hash.h | 4 ++--
 arch/powerpc/mm/init-common.c             | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/book3s/64/hash.h +2 -2
index f61cad3de4e6..e95148c72916 100644
@@ -33,9 +33,9 @@
 				 H_PUD_INDEX_SIZE + H_PGD_INDEX_SIZE + PAGE_SHIFT)
 #define H_PGTABLE_RANGE		(ASM_CONST(1) << H_PGTABLE_EADDR_SIZE)
 
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+#if defined(CONFIG_TRANSPARENT_HUGEPAGE) &&  !defined(CONFIG_PPC_4K_PAGES)
 /*
- * only with hash we need to use the second half of pmd page table
+ * only with hash 64k we need to use the second half of pmd page table
  * to store pointer to deposited pgtable_t
  */
 #define H_PMD_CACHE_INDEX	(H_PMD_INDEX_SIZE + 1)
arch/powerpc/mm/init-common.c +2 -2
index a175cd82ae8c..e733cf4d3401 100644
@@ -88,7 +88,7 @@ void pgtable_cache_init(void)
 {
 	pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor);
 
-	if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE))
+	if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX))
 		pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor);
 	/*
 	 * In all current configs, when the PUD index exists it's the
@@ -100,7 +100,7 @@ void pgtable_cache_init(void)
 
 	if (!PGT_CACHE(PGD_INDEX_SIZE))
 		panic("Couldn't allocate pgd cache");
-	if (PMD_INDEX_SIZE && !PGT_CACHE(PMD_INDEX_SIZE))
+	if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX))
 		panic("Couldn't allocate pmd pgtable caches");
 	if (PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE))
 		panic("Couldn't allocate pud pgtable caches");
Signature · 1 line
2.10.2