diff mbox series

[3/3] powerpc/8xx: Increase the number of mm slices

Message ID aed2799c8b369bd2ffba9967ed052e21d33e76f0.1515169256.git.christophe.leroy@c-s.fr (mailing list archive)
State Superseded
Headers show
Series [1/3] powerpc/32: Fix hugepage allocation on 8xx at hint address | expand

Commit Message

Christophe Leroy Jan. 5, 2018, 4:44 p.m. UTC
On the 8xx, we can have as many slices as PMD entries.
This means we could have 1024 slices in 4k size pages mode
and 64 slices in 16k size pages.

However, due to a stack overflow in slice_get_unmapped_area(),
we limit to 512 slices.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/mmu-8xx.h | 6 +++++-
 arch/powerpc/include/asm/page_32.h | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Aneesh Kumar K.V Jan. 16, 2018, 3:53 p.m. UTC | #1
Christophe Leroy <christophe.leroy@c-s.fr> writes:

> On the 8xx, we can have as many slices as PMD entries.
> This means we could have 1024 slices in 4k size pages mode
> and 64 slices in 16k size pages.
>
> However, due to a stack overflow in slice_get_unmapped_area(),
> we limit to 512 slices.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>  arch/powerpc/include/asm/mmu-8xx.h | 6 +++++-
>  arch/powerpc/include/asm/page_32.h | 3 ++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h
> index d669d0062da4..40aa7b0cd0dc 100644
> --- a/arch/powerpc/include/asm/mmu-8xx.h
> +++ b/arch/powerpc/include/asm/mmu-8xx.h
> @@ -171,7 +171,11 @@ typedef struct {
>  	unsigned long vdso_base;
>  #ifdef CONFIG_PPC_MM_SLICES
>  	u16 user_psize;		/* page size index */
> -	unsigned char low_slices_psize[8]; /* 16 slices */
> +#if defined(CONFIG_PPC_16K_PAGES)
> +	unsigned char low_slices_psize[32]; /* 64 slices */
> +#else
> +	unsigned char low_slices_psize[256]; /* 512 slices */
> +#endif

These #ifdef should be 8xx and then 16K.


>  	unsigned char high_slices_psize[0];
>  	unsigned long slb_addr_limit;
>  #endif
> diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
> index f7d1bd1183c8..43695ce7ee07 100644
> --- a/arch/powerpc/include/asm/page_32.h
> +++ b/arch/powerpc/include/asm/page_32.h
> @@ -62,7 +62,8 @@ extern void copy_page(void *to, void *from);
>  
>  #ifdef CONFIG_PPC_MM_SLICES
>  
> -#define SLICE_LOW_SHIFT		28
> +/* SLICE_LOW_SHIFT >= 23 to avoid stack overflow in slice_get_unmapped_area() */
> +#define SLICE_LOW_SHIFT		(PMD_SHIFT > 23 ? PMD_SHIFT : 23)
>  #define SLICE_HIGH_SHIFT	0
>  
>  #define SLICE_LOW_TOP		(0xfffffffful)
> -- 
> 2.13.3
Christophe Leroy Jan. 16, 2018, 4:16 p.m. UTC | #2
Le 16/01/2018 à 16:53, Aneesh Kumar K.V a écrit :
> Christophe Leroy <christophe.leroy@c-s.fr> writes:
> 
>> On the 8xx, we can have as many slices as PMD entries.
>> This means we could have 1024 slices in 4k size pages mode
>> and 64 slices in 16k size pages.
>>
>> However, due to a stack overflow in slice_get_unmapped_area(),
>> we limit to 512 slices.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> ---
>>   arch/powerpc/include/asm/mmu-8xx.h | 6 +++++-
>>   arch/powerpc/include/asm/page_32.h | 3 ++-
>>   2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h
>> index d669d0062da4..40aa7b0cd0dc 100644
>> --- a/arch/powerpc/include/asm/mmu-8xx.h
>> +++ b/arch/powerpc/include/asm/mmu-8xx.h
>> @@ -171,7 +171,11 @@ typedef struct {
>>   	unsigned long vdso_base;
>>   #ifdef CONFIG_PPC_MM_SLICES
>>   	u16 user_psize;		/* page size index */
>> -	unsigned char low_slices_psize[8]; /* 16 slices */
>> +#if defined(CONFIG_PPC_16K_PAGES)
>> +	unsigned char low_slices_psize[32]; /* 64 slices */
>> +#else
>> +	unsigned char low_slices_psize[256]; /* 512 slices */
>> +#endif
> 
> These #ifdef should be 8xx and then 16K.

We are in file asm/mmu-8xx.h so it obviously only applies to 8xx

Christophe

> 
> 
>>   	unsigned char high_slices_psize[0];
>>   	unsigned long slb_addr_limit;
>>   #endif
>> diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
>> index f7d1bd1183c8..43695ce7ee07 100644
>> --- a/arch/powerpc/include/asm/page_32.h
>> +++ b/arch/powerpc/include/asm/page_32.h
>> @@ -62,7 +62,8 @@ extern void copy_page(void *to, void *from);
>>   
>>   #ifdef CONFIG_PPC_MM_SLICES
>>   
>> -#define SLICE_LOW_SHIFT		28
>> +/* SLICE_LOW_SHIFT >= 23 to avoid stack overflow in slice_get_unmapped_area() */
>> +#define SLICE_LOW_SHIFT		(PMD_SHIFT > 23 ? PMD_SHIFT : 23)
>>   #define SLICE_HIGH_SHIFT	0
>>   
>>   #define SLICE_LOW_TOP		(0xfffffffful)
>> -- 
>> 2.13.3
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/mmu-8xx.h b/arch/powerpc/include/asm/mmu-8xx.h
index d669d0062da4..40aa7b0cd0dc 100644
--- a/arch/powerpc/include/asm/mmu-8xx.h
+++ b/arch/powerpc/include/asm/mmu-8xx.h
@@ -171,7 +171,11 @@  typedef struct {
 	unsigned long vdso_base;
 #ifdef CONFIG_PPC_MM_SLICES
 	u16 user_psize;		/* page size index */
-	unsigned char low_slices_psize[8]; /* 16 slices */
+#if defined(CONFIG_PPC_16K_PAGES)
+	unsigned char low_slices_psize[32]; /* 64 slices */
+#else
+	unsigned char low_slices_psize[256]; /* 512 slices */
+#endif
 	unsigned char high_slices_psize[0];
 	unsigned long slb_addr_limit;
 #endif
diff --git a/arch/powerpc/include/asm/page_32.h b/arch/powerpc/include/asm/page_32.h
index f7d1bd1183c8..43695ce7ee07 100644
--- a/arch/powerpc/include/asm/page_32.h
+++ b/arch/powerpc/include/asm/page_32.h
@@ -62,7 +62,8 @@  extern void copy_page(void *to, void *from);
 
 #ifdef CONFIG_PPC_MM_SLICES
 
-#define SLICE_LOW_SHIFT		28
+/* SLICE_LOW_SHIFT >= 23 to avoid stack overflow in slice_get_unmapped_area() */
+#define SLICE_LOW_SHIFT		(PMD_SHIFT > 23 ? PMD_SHIFT : 23)
 #define SLICE_HIGH_SHIFT	0
 
 #define SLICE_LOW_TOP		(0xfffffffful)