Subject: [PATCH] powerpc: change 64K->16K page size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is out of our work for the PAC demos in May and is not actively used. I just wanted to post it for documentation reasons before I drop the old development directories. If we ever want to continue on that path again e.g. going towards full hugetlbfs this could be useful again.


--

Grüsse / regards, Christian Ehrhardt
IBM Linux Technology Center, Open Virtualization

Subject: [PATCH] powerpc: change 64K->16K page size

From: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>

Based on the 64K page size patches in our dev repo I made these changes to try
it with 16K page size. In our demo env it still failed eventually triggering
the oom killer.
The patch is based on the 64K patches Hollis adapted to our repo and some older
posts from Yuri Tikhonov about that topic on ppc dev mailing lists.
This patch requires the 64K patches to be applied.

Signed-off-by: Christian Ehrhardt <ehrhardt@xxxxxxxxxxxxxxxxxx>
---

[diffstat]
 arch/powerpc/Kconfig               |    8 ++++----
 arch/powerpc/lib/dma-noncoherent.c |    3 ++-
 include/asm-powerpc/page.h         |   16 ++++++++--------
 include/asm-powerpc/page_32.h      |    9 +++------
 include/asm-powerpc/ppc_page_asm.h |   24 ++++++++++++------------
 5 files changed, 29 insertions(+), 31 deletions(-)

[diff]

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -390,13 +390,13 @@ config PPC_HAS_HASH_64K
 	depends on PPC64
 	default n
 
-config PPC_64K_PAGES
-	bool "64k page size"
+config PPC_16K_PAGES
+	bool "16k page size"
 	depends on PPC64 || 44x
 	select PPC_HAS_HASH_64K
 	help
-	  This option changes the kernel logical page size to 64k. On machines
-	  without processor support for 64k pages, the kernel will simulate
+	  This option changes the kernel logical page size to 16k. On machines
+	  without processor support for 16k pages, the kernel will simulate
 	  them by loading each individual 4k page on demand transparently,
 	  while on hardware with such support, it will be used to map
 	  normal application pages.
diff --git a/arch/powerpc/lib/dma-noncoherent.c b/arch/powerpc/lib/dma-noncoherent.c
--- a/arch/powerpc/lib/dma-noncoherent.c
+++ b/arch/powerpc/lib/dma-noncoherent.c
@@ -320,7 +320,8 @@ static int __init dma_alloc_init(void)
 			ret = -ENOMEM;
 			break;
 		}
-		WARN_ON(!pmd_none(*pmd));
+		if(!pmd_none(*pmd))
+			printk("%s warning: PMD is not empty.\n", __FUNCTION__);
 
 		pte = pte_alloc_kernel(pmd, CONSISTENT_BASE);
 		if (!pte) {
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -19,8 +19,8 @@
  * page size. When using 64K pages however, whether we are really supporting
  * 64K pages in HW or not is irrelevant to those definitions.
  */
-#ifdef CONFIG_PPC_64K_PAGES
-#define PAGE_SHIFT		16
+#ifdef CONFIG_PPC_16K_PAGES
+#define PAGE_SHIFT		14
 #else
 #define PAGE_SHIFT		12
 #endif
@@ -143,7 +143,7 @@ typedef struct { pte_basic_t pte; } pte_
 /* 64k pages additionally define a bigger "real PTE" type that gathers
  * the "second half" part of the PTE for pseudo 64k pages
  */
-#ifdef CONFIG_PPC_64K_PAGES
+#ifdef CONFIG_PPC_16K_PAGES
 typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
 #else
 typedef struct { pte_t pte; } real_pte_t;
@@ -156,11 +156,11 @@ typedef struct { unsigned long pmd; } pm
 #define __pmd(x)	((pmd_t) { (x) })
 
 /* PUD level exusts only on 4k pages */
-#ifndef CONFIG_PPC_64K_PAGES
+#ifndef CONFIG_PPC_16K_PAGES
 typedef struct { unsigned long pud; } pud_t;
 #define pud_val(x)	((x).pud)
 #define __pud(x)	((pud_t) { (x) })
-#endif /* !CONFIG_PPC_64K_PAGES */
+#endif /* !CONFIG_PPC_16K_PAGES */
 #endif /* CONFIG_PPC64 */
 
 /* PGD level */
@@ -183,7 +183,7 @@ typedef pte_basic_t pte_t;
 #define pte_val(x)	(x)
 #define __pte(x)	(x)
 
-#ifdef CONFIG_PPC_64K_PAGES
+#ifdef CONFIG_PPC_16K_PAGES
 typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
 #else
 typedef unsigned long real_pte_t;
@@ -195,11 +195,11 @@ typedef unsigned long pmd_t;
 #define pmd_val(x)	(x)
 #define __pmd(x)	(x)
 
-#ifndef CONFIG_PPC_64K_PAGES
+#ifndef CONFIG_PPC_16K_PAGES
 typedef unsigned long pud_t;
 #define pud_val(x)	(x)
 #define __pud(x)	(x)
-#endif /* !CONFIG_PPC_64K_PAGES */
+#endif /* !CONFIG_PPC_16K_PAGES */
 #endif /* CONFIG_PPC64 */
 
 typedef unsigned long pgd_t;
diff --git a/include/asm-powerpc/page_32.h b/include/asm-powerpc/page_32.h
--- a/include/asm-powerpc/page_32.h
+++ b/include/asm-powerpc/page_32.h
@@ -20,12 +20,9 @@
  */
 #ifdef CONFIG_PTE_64BIT
 typedef unsigned long long pte_basic_t;
-#ifdef CONFIG_PPC_64K_PAGES
-#define PTE_SHIFT	(PAGE_SHIFT - 11)
-#else /* CONFIG_PPC_64K_PAGES */
-#define PTE_SHIFT	(PAGE_SHIFT - 3)	/* 512 ptes per page */
-#endif /* CONFIG_PPC_64K_PAGES */
-#else
+#define PTE_SHIFT	(PAGE_SHIFT - 3)
+#else /* CONFIG_PTE_64BIT */
+#error
 typedef unsigned long pte_basic_t;
 #define PTE_SHIFT	(PAGE_SHIFT - 2)	/* 1024 ptes per page */
 #endif
diff --git a/include/asm-powerpc/ppc_page_asm.h b/include/asm-powerpc/ppc_page_asm.h
--- a/include/asm-powerpc/ppc_page_asm.h
+++ b/include/asm-powerpc/ppc_page_asm.h
@@ -16,20 +16,20 @@
 
 #include <asm/page.h>
 
-#ifdef CONFIG_PPC_64K_PAGES
+#ifdef CONFIG_PPC_16K_PAGES
 /*
- * PAGE_SIZE  64K
- * PAGE_SHIFT 16
- * PTE_SHIFT   5
- * PMD_SHIFT  21
+ * PAGE_SIZE  16K
+ * PAGE_SHIFT 14
+ * PTE_SHIFT  11
+ * PMD_SHIFT  25
  */
-#define PPC44x_TLBE_SIZE	PPC44x_TLB_64K
-#define PPC44x_PGD_OFF_SH	13 /*(32 - PMD_SHIFT + 2)*/
-#define PPC44x_PGD_OFF_M1	19 /*(PMD_SHIFT - 2)*/
-#define PPC44x_PTE_ADD_SH	19 /*32 - PMD_SHIFT + PTE_SHIFT + 3*/
-#define PPC44x_PTE_ADD_M1	24 /*32 - 3 - PTE_SHIFT*/
-#define PPC44x_RPN_M2		15 /*31 - PAGE_SHIFT*/
-#else /* CONFIG_PPC_64K_PAGES */
+#define PPC44x_TLBE_SIZE	PPC44x_TLB_16K
+#define PPC44x_PGD_OFF_SH	9 /*(32 - PMD_SHIFT + 2)*/
+#define PPC44x_PGD_OFF_M1	23 /*(PMD_SHIFT - 2)*/
+#define PPC44x_PTE_ADD_SH	21 /*32 - PMD_SHIFT + PTE_SHIFT + 3*/
+#define PPC44x_PTE_ADD_M1	18 /*32 - 3 - PTE_SHIFT*/
+#define PPC44x_RPN_M2		17 /*31 - PAGE_SHIFT*/
+#else /* CONFIG_PPC_16K_PAGES */
 /* 
  * PAGE_SIZE  4K 
  * PAGE_SHIFT 12

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux