Skip to contentSkip to conversation

ppc: Add support for bigger page sizes than 4KB on PPC44x

PATCH Yuri Tikhonov 2 participants 6 messages Mar 16, 2007 – Apr 25, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines · Benjamin Herrenschmidt

- You only adapted head_4xx.S but the config option is global to all of arch/ppc, thus changing it will probably break everything else. Make sure the option is done in such a way that it can't be changed or the kernel doesn't build if changed for a processor family where you haven't implemented the support

The configuration option we had introduced changes the global PPC PAGE_SIZE
definition indeed. To let changing the PAGE_SIZE from the configuration menu for the 44x processors only the following modification of the arch/ppc/Kconfig file might make sense:

- int "Page size (12=>4KB; 16=>64KB)"
+ int "Page size (12=>4KB; 16=>64KB)" if 44x

For other than 44x processors the PPC_PAGE_SHIFT value will be unchangeable
from the configuration menu and set to default value 12 ( PAGE_SIZE = 4 KB).

Quoted 4 lines

- Have you tried other page sizes ? How hard would it be to support 16K and what kind of performance numbers do you get with 16K ? It's a better compromise for some applications as 64K causes significant bloat of the page cache (among other things).

To support 16K, one more bunch of definitions should be calculated and added
to the include/asm/ppc_page_asm.h file (for PAGE_SHIFT = 14). Attached is the patch that adds 16KB PAGE_SIZE capability for the ppc44x processors.

Regards, Yuri.

Support for the PAGE_SIZE = 16 KB on the PPC32 44x platforms.

---

arch/ppc/Kconfig +1 -1
index e825e98..72af523 100644
@@ -1202,7 +1202,7 @@ config SECCOMP
 	  If unsure, say Y. Only embedded should say N here.
 
 config PPC_PAGE_SHIFT
-	int "Page size (12=>4KB; 16=>64KB)" if 44x
+	int "Page size (12=>4KB; 14=>16KB; 16=>64KB)" if 44x
 	default "12"
 	range 12 16
 	help
include/asm-ppc/page.h +3 -1
index 61698ac..0b8f354 100644
@@ -29,7 +29,9 @@
 #ifdef CONFIG_PTE_64BIT
 typedef unsigned long long pte_basic_t;
 #if (PAGE_SHIFT == 16) && defined(CONFIG_PPC32)
-#define PTE_SHIFT	(PAGE_SHIFT - 11)	/* 256 ptes per table*/
+#define PTE_SHIFT	(PAGE_SHIFT - 11)	/* 32 ptes per table */
+#elif (PAGE_SHIFT == 14) && defined(CONFIG_PPC32)
+#define PTE_SHIFT	(PAGE_SHIFT - 7)	/* 128 ptes per table */
 #else
 #define PTE_SHIFT	(PAGE_SHIFT - 3)	/* 512 ptes per page */
 #endif
include/asm-ppc/ppc_page_asm.h +13 -0
index 4918ddc..4f7ee78 100644
@@ -29,6 +29,19 @@
 #define PPC44x_PTE_ADD_SH	23 /*32 - PMD_SHIFT + PTE_SHIFT + 3*/
 #define PPC44x_PTE_ADD_M1	20 /*32 - 3 - PTE_SHIFT*/
 #define PPC44x_RPN_M2		19 /*31 - PAGE_SHIFT*/
+#elif (PAGE_SHIFT == 14)
+/*
+ * PAGE_SIZE  16K
+ * PAGE_SHIFT 14
+ * PTE_SHIFT  7
+ * PMD_SHIFT  21
+ */
+#define PPC44x_TLB_SIZE		PPC44x_TLB_16K
+#define PPC44x_PGD_OFF_SH	13 /*(32 - PMD_SHIFT + 2)*/
+#define PPC44x_PGD_OFF_M1	19 /*(PMD_SHIFT - 2)*/
+#define PPC44x_PTE_ADD_SH	21 /*32 - PMD_SHIFT + PTE_SHIFT + 3*/
+#define PPC44x_PTE_ADD_M1	22 /*32 - 3 - PTE_SHIFT*/
+#define PPC44x_RPN_M2		17 /*31 - PAGE_SHIFT*/
 #elif (PAGE_SHIFT == 16)
 /*
  * PAGE_SIZE  64K
#1 lore raw
Quoted 10 lines · Yuri Tikhonov

The configuration option we had introduced changes the global PPC PAGE_SIZE
definition indeed. To let changing the PAGE_SIZE from the configuration menu for the 44x processors only the following modification of the arch/ppc/Kconfig file might make sense:

- int "Page size (12=>4KB; 16=>64KB)"
+ int "Page size (12=>4KB; 16=>64KB)" if 44x

For other than 44x processors the PPC_PAGE_SHIFT value will be unchangeable
from the configuration menu and set to default value 12 ( PAGE_SIZE = 4 KB).

Your patch would still let users select a page shift of 13 or 15, which won't work (and can't be made to work).

Paul.

#2 lore raw
Quoted 2 lines · Paul Mackerras

Your patch would still let users select a page shift of 13 or 15, which won't work (and can't be made to work).

Selecting 13 or 15 will lead to a compile-time error "Unsupported PAGE_SIZE"
(in include/asm/ppc_page_asm.h), so users will not be able to run kernel with PAGE_SIZE different than 4K, 16K or 64K anyway.

Do you think that replacing one integer option CONFIG_PPC_PAGE_SHIFT with
three logical options (i.e., CONFIG_PPC_PAGE_SIZE_4K, CONFIG_PPC_PAGE_SIZE_16K and CONFIG_PPC_PAGE_SIZE_64K) will be the better choice ?

Regards, Yuri.

#3 lore raw
Quoted 4 lines · Yuri Tikhonov

Do you think that replacing one integer option CONFIG_PPC_PAGE_SHIFT with
three logical options (i.e., CONFIG_PPC_PAGE_SIZE_4K, CONFIG_PPC_PAGE_SIZE_16K and CONFIG_PPC_PAGE_SIZE_64K) will be the better choice ?

I think you should use a choice...endchoice construct in Kconfig, which will result in 2 config options, or 3 if you choose to support 16k pages.

Paul.

#4 lore raw

Paul,

Quoted 9 lines · you
Quoted 4 lines · Yuri Tikhonov

Do you think that replacing one integer option CONFIG_PPC_PAGE_SHIFT
with three logical options (i.e., CONFIG_PPC_PAGE_SIZE_4K, CONFIG_PPC_PAGE_SIZE_16K and CONFIG_PPC_PAGE_SIZE_64K) will be the better choice ?

I think you should use a choice...endchoice construct in Kconfig, which will result in 2 config options, or 3 if you choose to support 16k pages.

Yes, there will be 3 options. Thank you!

Regards, Yuri.

Quoted 2 lines

Paul.

#5 lore raw
In reply to Paul Mackerras

The patch replaces the CONFIG_PPC_PAGE_SHIFT integer option with choice of
three boolean options

--

arch/ppc/Kconfig +15 -6
index 72af523..5eb58dc 100644
@@ -1201,15 +1201,24 @@ config SECCOMP
 
          If unsure, say Y. Only embedded should say N here.
 
-config PPC_PAGE_SHIFT
-       int "Page size (12=>4KB; 14=>16KB; 16=>64KB)" if 44x
-       default "12"
-       range 12 16
-       help
+choice
+       prompt "Page size"
+       default PPC_PAGE_4K
+       ---help---
          The PAGE_SIZE definition. Increasing the page size may
          improve the system performance in some dedicated cases.
 
-         If unsure, set it to 12 (4KB).
+         If unsure, set it to 4 KB.
+
+config PPC_PAGE_4K
+       bool "4 KB"
+
+config PPC_PAGE_16K
+       bool "16 KB" if 44x
+
+config PPC_PAGE_64K
+       bool "64 KB" if 44x
+endchoice
 
 endmenu
 
include/asm-ppc/page.h +7 -1
index 0b8f354..f46712e 100644
@@ -4,7 +4,13 @@
 #include <asm/asm-compat.h>
 
 /* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT     CONFIG_PPC_PAGE_SHIFT
+#if defined(CONFIG_PPC_PAGE_4K)
+#define PAGE_SHIFT     12
+#elif defined(CONFIG_PPC_PAGE_16K)
+#define PAGE_SHIFT     14
+#elif defined(CONFIG_PPC_PAGE_64K)
+#define PAGE_SHIFT     16
+#endif
 #define PAGE_SIZE      (ASM_CONST(1) << PAGE_SHIFT)
 
 /*