Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-28 Thread David Gibson
On Sat, Sep 27, 2008 at 03:35:27AM +0400, Ilya Yanok wrote:
> Hello David,
>
> David Gibson wrote:
>> I don't see any reason to have a separate set of config options for 32
>> and 64-bit.  Just make the once choice, but only have the individual
>> pagesize options enabled on machines that support them.
>
> Well. I can see some. First, on PPC64 kernel emulates 64K pages on  
> hardware that can't do it and we are not going to do such an emulation  
> on PPC32 now.

So?

> Then CONFIG_PPC_64K_PAGES selects PPC_HAS_HASH_64K and our  
> code has nothing to do with it. 

Well, obviously the generic 64K option wouldn't select
PPC_HAS_HASH_64K.  That would be dependent on both 64K_PAGES and
PPC64.

> And last but not least, we don't use  
> PPC64 kernels for now so we just tried not to break something we can't  
> test. But if everybody thinks that having a single option is a good idea  
> I'll do it that way.

Hrm, well that has something to be said for it.  But it's not hard to
at least build a ppc64 kernel to test if you've broken that.

>> I don't think you should need a real_pte_t type for the 32-bit
>> implementation.  It's just there because of how we implement
>> 64k granularity page allocation on hardware that only does 4k
>> translations.
>
> You are right. Thanks.
>
>>> diff --git a/arch/powerpc/include/asm/page_32.h 
>>> b/arch/powerpc/include/asm/page_32.h
>>> index ebfae53..d176270 100644
>>> --- a/arch/powerpc/include/asm/page_32.h
>>> +++ b/arch/powerpc/include/asm/page_32.h
>>> @@ -20,7 +20,11 @@
>>>   */
>>>  #ifdef CONFIG_PTE_64BIT
>>>  typedef unsigned long long pte_basic_t;
>>> +#ifdef CONFIG_PPC32_256K_PAGES
>>> +#define PTE_SHIFT  (PAGE_SHIFT - 7)
>>> 
>>
>> This doesn't look right.  You should be eliding one of the levels of
>> page table if you don't need it, rather than leaving the bottom level
>> PTE page largely empty.
>
> Hm... We have only two levels really so if we elide one there will be  
> only one left. Don't sure if kernel can work with this...

Ah.. that's a point.  But again this is a 256K specific hack, so we
can worry about it later.

>>> +#if (PAGE_SHIFT == 12)
>>> +/*
>>> + * PAGE_SIZE  4K
>>> + * PAGE_SHIFT 12
>>> + * PTE_SHIFT   9
>>> + * PMD_SHIFT  21
>>> + */
>>> +#define PPC44x_TLBE_SIZE   PPC44x_TLB_4K
>>> +#define PPC44x_PGD_OFF_SH  13 /*(32 - PMD_SHIFT + 2)*/
>>> +#define PPC44x_PGD_OFF_M1  19 /*(PMD_SHIFT - 2)*/
>>> +#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*/
>>> 
>>
>> Uh.. you have the formulae for these things right there in the
>> comments, so why aren't you using those and avoiding this nasty
>> multiway ifdef...
>
> We need to get PMD_SHIFT and friends out of #ifndef __ASSEMBLY__ for  
> that. And some of them are under include/asm-generic so patch becomes  
> not powerpc-specific...

So use arch/powerpc/kernel/asm-offsets.c, that's what it's for.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-26 Thread Ilya Yanok

Hello Benjamin,

Benjamin Herrenschmidt wrote:

[snip]


diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index fce2df9..4f802df 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -20,7 +20,9 @@
beq 1f;  \
mfspr   r1,SPRN_SPRG3;  /* if from user, start at top of   */\
lwz r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack   */\
-   addir1,r1,THREAD_SIZE;   \
+   lis r11,[EMAIL PROTECTED];   \
+   ori r11,r11,[EMAIL PROTECTED];  
 \
+   add r1,r1,r11;
\
  

It would be nice if we could avoid the extra instruction here when the
page sizes isn't big enough to require it.



As a matter of fact, I don't see why THREAD_SIZE should ever need that,
there is no reason to change the kernel stack size.
  


Well, this was introduced because of that:

kernel/fork.c [179]:

max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE);

With THREAD_SIZE=8K we will get mempages divided by zero if PAGE_SIZE is 
bigger than 64K. (Well, another reason not to use >64K pages). Not sure 
this is the right way to fix it.


Regards, Ilya.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-26 Thread Ilya Yanok

Hello David,

David Gibson wrote:

I don't see any reason to have a separate set of config options for 32
and 64-bit.  Just make the once choice, but only have the individual
pagesize options enabled on machines that support them.
  


Well. I can see some. First, on PPC64 kernel emulates 64K pages on 
hardware that can't do it and we are not going to do such an emulation 
on PPC32 now. Then CONFIG_PPC_64K_PAGES selects PPC_HAS_HASH_64K and our 
code has nothing to do with it. And last but not least, we don't use 
PPC64 kernels for now so we just tried not to break something we can't 
test. But if everybody thinks that having a single option is a good idea 
I'll do it that way.



I don't think you should need a real_pte_t type for the 32-bit
implementation.  It's just there because of how we implement
64k granularity page allocation on hardware that only does 4k
translations.
  


You are right. Thanks.


diff --git a/arch/powerpc/include/asm/page_32.h 
b/arch/powerpc/include/asm/page_32.h
index ebfae53..d176270 100644
--- a/arch/powerpc/include/asm/page_32.h
+++ b/arch/powerpc/include/asm/page_32.h
@@ -20,7 +20,11 @@
  */
 #ifdef CONFIG_PTE_64BIT
 typedef unsigned long long pte_basic_t;
+#ifdef CONFIG_PPC32_256K_PAGES
+#define PTE_SHIFT  (PAGE_SHIFT - 7)



This doesn't look right.  You should be eliding one of the levels of
page table if you don't need it, rather than leaving the bottom level
PTE page largely empty.
  


Hm... We have only two levels really so if we elide one there will be 
only one left. Don't sure if kernel can work with this...



+#if (PAGE_SHIFT == 12)
+/*
+ * PAGE_SIZE  4K
+ * PAGE_SHIFT 12
+ * PTE_SHIFT   9
+ * PMD_SHIFT  21
+ */
+#define PPC44x_TLBE_SIZE   PPC44x_TLB_4K
+#define PPC44x_PGD_OFF_SH  13 /*(32 - PMD_SHIFT + 2)*/
+#define PPC44x_PGD_OFF_M1  19 /*(PMD_SHIFT - 2)*/
+#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*/



Uh.. you have the formulae for these things right there in the
comments, so why aren't you using those and avoiding this nasty
multiway ifdef...
  


We need to get PMD_SHIFT and friends out of #ifndef __ASSEMBLY__ for 
that. And some of them are under include/asm-generic so patch becomes 
not powerpc-specific...



diff --git a/arch/powerpc/include/asm/thread_info.h 
b/arch/powerpc/include/asm/thread_info.h
index 9665a26..4e7cd1f 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -15,8 +15,12 @@
 #ifdef CONFIG_PPC64
 #define THREAD_SHIFT   14
 #else
+#if defined(CONFIG_PPC32_256K_PAGES)
+#define THREAD_SHIFT   15



Hrm.. more peculiar special cases for 256K pages.  I think it might be
clearer if you split the patch into one which supports page sizes up
to 64k, then another that does the extra hacks for 256k pages.
  


Agreed.


diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h
index fce2df9..4f802df 100644
--- a/arch/powerpc/kernel/head_booke.h
+++ b/arch/powerpc/kernel/head_booke.h
@@ -20,7 +20,9 @@
beq 1f;  \
mfspr   r1,SPRN_SPRG3;  /* if from user, start at top of   */\
lwz r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack   */\
-   addir1,r1,THREAD_SIZE;   \
+   lis r11,[EMAIL PROTECTED];   \
+   ori r11,r11,[EMAIL PROTECTED];  
 \
+   add r1,r1,r11;
\



It would be nice if we could avoid the extra instruction here when the
page sizes isn't big enough to require it.
  


Ok. This is going to go to 256K-dirty-hacks.patch anyway.

Regards, Ilya.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-13 Thread Josh Boyer
On Sat, 13 Sep 2008 10:49:13 -0700
Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:

> On Thu, 2008-09-11 at 09:57 -0700, prodyut hazarika wrote:
> 
> > You should mention an example of dedicated cases (eg. RAID).
> > I think this help should mention that for page size 256KB, you will
> > need to have a special version of binutils, since the ELF standard
> > mentions page sizes only upto 64KB.
> 
> He should also put a BIG FAT warning with 256K pages. Those will -not-
> work with most existing userspace. The maximum page size supported by
> the current userspace ABI is 64K as this is the alignment requirement of
> our toolchain for the various program sections.

I think that's been noted like 5 times now :)

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-13 Thread Benjamin Herrenschmidt
On Thu, 2008-09-11 at 09:57 -0700, prodyut hazarika wrote:

> You should mention an example of dedicated cases (eg. RAID).
> I think this help should mention that for page size 256KB, you will
> need to have a special version of binutils, since the ELF standard
> mentions page sizes only upto 64KB.

He should also put a BIG FAT warning with 256K pages. Those will -not-
work with most existing userspace. The maximum page size supported by
the current userspace ABI is 64K as this is the alignment requirement of
our toolchain for the various program sections.

(Note that uClibc last I looked was also still broken with >4K pages but
that shouldn't be a big deal to fix).

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-13 Thread Benjamin Herrenschmidt

> [snip]
> > diff --git a/arch/powerpc/kernel/head_booke.h 
> > b/arch/powerpc/kernel/head_booke.h
> > index fce2df9..4f802df 100644
> > --- a/arch/powerpc/kernel/head_booke.h
> > +++ b/arch/powerpc/kernel/head_booke.h
> > @@ -20,7 +20,9 @@
> > beq 1f;  \
> > mfspr   r1,SPRN_SPRG3;  /* if from user, start at top of   */\
> > lwz r1,THREAD_INFO-THREAD(r1); /* this thread's kernel stack   */\
> > -   addir1,r1,THREAD_SIZE;   \
> > +   lis r11,[EMAIL PROTECTED];   \
> > +   ori r11,r11,[EMAIL PROTECTED];  
> >  \
> > +   add r1,r1,r11;
> > \
> 
> It would be nice if we could avoid the extra instruction here when the
> page sizes isn't big enough to require it.

As a matter of fact, I don't see why THREAD_SIZE should ever need that,
there is no reason to change the kernel stack size.

> >  1: subir1,r1,INT_FRAME_SIZE;   /* Allocate an exception frame */\
> > mr  r11,r1;  \
> > stw r10,_CCR(r11);  /* save various registers  */\
> > @@ -112,7 +114,8 @@
> > andi.   r10,r10,MSR_PR;  \
> > mfspr   r11,SPRN_SPRG3; /* if from user, start at top of   */\
> > lwz r11,THREAD_INFO-THREAD(r11); /* this thread's kernel stack */\
> > -   addir11,r11,EXC_LVL_FRAME_OVERHEAD; /* allocate stack frame*/\
> > +   addis   r11,r11,[EMAIL PROTECTED]; /* allocate stack frame */\
> > +   addir11,r11,[EMAIL PROTECTED];  /* allocate stack frame */\
> 
> And here.

Same comment. That size doesn't need to change and can remain safely
below 32k

Ben.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread David Gibson
On Thu, Sep 11, 2008 at 01:53:06AM +0400, Ilya Yanok wrote:
> This patch adds support for page sizes bigger than 4KB (16KB/64KB/256KB) on
> PPC 44x.

[snip]
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 587da5e..ca93157 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -413,6 +413,29 @@ config PPC_64K_PAGES
> while on hardware with such support, it will be used to map
> normal application pages.
>  
> +choice
> + prompt "Page size"
> + depends on 44x && PPC32
> + default PPC32_4K_PAGES
> + help
> +   The PAGE_SIZE definition. Increasing the page size may
> +   improve the system performance in some dedicated cases.
> +   If unsure, set it to 4 KB.
> +
> +config PPC32_4K_PAGES
> + bool "4k page size"
> +
> +config PPC32_16K_PAGES
> + bool "16k page size"
> +
> +config PPC32_64K_PAGES
> + bool "64k page size"
> +
> +config PPC32_256K_PAGES
> + bool "256k page size"
> +

I don't see any reason to have a separate set of config options for 32
and 64-bit.  Just make the once choice, but only have the individual
pagesize options enabled on machines that support them.

[snip]
> index e088545..1de90b4 100644
> --- a/arch/powerpc/include/asm/page.h
> +++ b/arch/powerpc/include/asm/page.h
> @@ -15,12 +15,17 @@
>  #include 
>  
>  /*
> - * On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
> + * On regular PPC32 page size is 4K (but we support 4K/16K/64K/256K pages
> + * on PPC44x). For PPC64 we support either 4K or 64K software
>   * 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
> +#if defined(CONFIG_PPC32_256K_PAGES)
> +#define PAGE_SHIFT   18
> +#elif defined(CONFIG_PPC32_64K_PAGES) || defined(CONFIG_PPC_64K_PAGES)
>  #define PAGE_SHIFT   16
> +#elif defined(CONFIG_PPC32_16K_PAGES)
> +#define PAGE_SHIFT   14
>  #else
>  #define PAGE_SHIFT   12
>  #endif
> @@ -140,11 +145,19 @@ typedef struct { pte_basic_t pte; } pte_t;
>  /* 64k pages additionally define a bigger "real PTE" type that gathers
>   * the "second half" part of the PTE for pseudo 64k pages
>   */
> +#ifdef CONFIG_PPC64
>  #ifdef CONFIG_PPC_64K_PAGES
>  typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
>  #else
>  typedef struct { pte_t pte; } real_pte_t;
>  #endif
> +#else
> +#ifdef CONFIG_PPC32_4K_PAGES
> +typedef struct { pte_t pte; } real_pte_t;
> +#else
> +typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;

I don't think you should need a real_pte_t type for the 32-bit
implementation.  It's just there because of how we implement
64k granularity page allocation on hardware that only does 4k
translations.

[snip]
> diff --git a/arch/powerpc/include/asm/page_32.h 
> b/arch/powerpc/include/asm/page_32.h
> index ebfae53..d176270 100644
> --- a/arch/powerpc/include/asm/page_32.h
> +++ b/arch/powerpc/include/asm/page_32.h
> @@ -20,7 +20,11 @@
>   */
>  #ifdef CONFIG_PTE_64BIT
>  typedef unsigned long long pte_basic_t;
> +#ifdef CONFIG_PPC32_256K_PAGES
> +#define PTE_SHIFT(PAGE_SHIFT - 7)

This doesn't look right.  You should be eliding one of the levels of
page table if you don't need it, rather than leaving the bottom level
PTE page largely empty.

[snip]
> +#if (PAGE_SHIFT == 12)
> +/*
> + * PAGE_SIZE  4K
> + * PAGE_SHIFT 12
> + * PTE_SHIFT   9
> + * PMD_SHIFT  21
> + */
> +#define PPC44x_TLBE_SIZE PPC44x_TLB_4K
> +#define PPC44x_PGD_OFF_SH13 /*(32 - PMD_SHIFT + 2)*/
> +#define PPC44x_PGD_OFF_M119 /*(PMD_SHIFT - 2)*/
> +#define PPC44x_PTE_ADD_SH23 /*32 - PMD_SHIFT + PTE_SHIFT + 3*/
> +#define PPC44x_PTE_ADD_M120 /*32 - 3 - PTE_SHIFT*/
> +#define PPC44x_RPN_M219 /*31 - PAGE_SHIFT*/

Uh.. you have the formulae for these things right there in the
comments, so why aren't you using those and avoiding this nasty
multiway ifdef...

[snip]
> diff --git a/arch/powerpc/include/asm/thread_info.h 
> b/arch/powerpc/include/asm/thread_info.h
> index 9665a26..4e7cd1f 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -15,8 +15,12 @@
>  #ifdef CONFIG_PPC64
>  #define THREAD_SHIFT 14
>  #else
> +#if defined(CONFIG_PPC32_256K_PAGES)
> +#define THREAD_SHIFT 15

Hrm.. more peculiar special cases for 256K pages.  I think it might be
clearer if you split the patch into one which supports page sizes up
to 64k, then another that does the extra hacks for 256k pages.

[snip]
> @@ -391,12 +392,14 @@ interrupt_base:
>   rlwimi  r13,r12,10,30,30
>  
>   /* Load the PTE */
> - rlwinm  r12, r10, 13, 19, 29/* Compute pgdir/pmd offset */
> + /* Compute pgdir/pmd offset */
> + rlwinm  r12, r10, PPC44x_PGD_OFF_SH, PPC44x_PGD_OFF_M1, 29

I agree with others that these constants need better names.  Or even
derive the values from PMD_SHIFT or whatnot right

Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread Josh Boyer
On Fri, 12 Sep 2008 03:38:39 +0400
Ilya Yanok <[EMAIL PROTECTED]> wrote:

> Hello Josh,
> 
> Josh Boyer wrote:
> > Ok, but not everyone does.  And I think setting the page size to this
> > should be harder, maybe even dependent upon CONFIG_BROKEN.
> >   
> 
> Well, we are violating ELF standard here... CONFIG_BROKEN seems to be 
> adequate for me.

Right, that was my thinking as well.  You can add an explanation for
that in the help text.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread Ilya Yanok

Hello Josh,

Josh Boyer wrote:

Ok, but not everyone does.  And I think setting the page size to this
should be harder, maybe even dependent upon CONFIG_BROKEN.
  


Well, we are violating ELF standard here... CONFIG_BROKEN seems to be 
adequate for me.



I need to look over the patch a bit more, but some of the comments you've
already gotten seem valid.
  


I'll address them and post updated patch in a few days.

Regards, Ilya.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread Ilya Yanok

Hi,

prodyut hazarika wrote:

In file arch/powerpc/mm/pgtable_32.c, we have:

#ifdef CONFIG_PTE_64BIT
/* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */
#define PGDIR_ORDER 1
#else
#define PGDIR_ORDER 0
#endif
pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *ret;

ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, PGDIR_ORDER);
return ret;
}

Thus, we allocate 2 pages for 44x processors for PGD. This is needed
only for 4K page.
We are anyway not using the whole 64K or 256K page for the PGD. So
there is no point to waste an additional 64K or 256KB page
  


Ok. Not sure I'm right but I think 16K case doesn't need second page 
too. (PGDIR_SHIFT=25, so sizeof(pgd_t)<<(32-PGDIR_SHIFT) < 16KB)



Change this to:
#ifdef CONFIG_PTE_64BIT
#if (PAGE_SHIFT == 12)
  


I think #ifdef CONFIG_PTE_64BIT is a little bit confusing here...  
Actually PGDIR_ORDER  should be something like max(32 + 2 - PGDIR_SHIFT 
- PAGE_SHIFT, 0)



/* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */
#define PGDIR_ORDER 1
#else
#define PGDIR_ORDER 0
#endif
#else
#define PGDIR_ORDER 0
#endif
  


Yuri, any comments?

Regards, Ilya.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread prodyut hazarika
>/*
> * Create WS1. This is the faulting address (EPN),
> * page size, and valid flag.
> */
> -   li  r11,PPC44x_TLB_VALID | PPC44x_TLB_4K
> +   li  r11,PPC44x_TLB_VALID | PPC44x_TLBE_SIZE
>rlwimi  r10,r11,0,20,31 /* Insert valid and page size*/
>tlbwe   r10,r13,PPC44x_TLB_PAGEID   /* Write PAGEID */
>

Change
>rlwimi  r10,r11,0,20,31 /* Insert valid and page size*/
to
>rlwimi  r10,r11,0,PPC44x_PTE_ADD_M1,31 /* Insert valid 
> and page size*/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread Ilya Yanok

Hi,

prodyut hazarika wrote:

Also, it would be great if you could point me what changes are
necessary to recompile the binutils.
I would like to test the 256KB changes on my Canyonlands board. I have
got 16KB/64KB working.
  


I think this should be enough:

--- binutils-2.16.1/ld/emulparams/elf32ppc.sh.orig2007-08-21 
14:18:56.0 +0200
+++ binutils-2.16.1/ld/emulparams/elf32ppc.sh2007-08-21 
14:19:42.0 +0200

@@ -8,7 +8,7 @@ GENERATE_PIE_SCRIPT=yes
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-powerpc"
TEXT_START_ADDR=0x0180
-MAXPAGESIZE=0x1
+MAXPAGESIZE=0x4
COMMONPAGESIZE=0x1000
ARCH=powerpc:common
MACHINE=
--- binutils-2.16.1/bfd/elf32-ppc.c.orig2007-09-04 
13:11:29.0 +0200

+++ binutils-2.16.1/bfd/elf32-ppc.c2007-09-04 13:10:25.0 +0200
@@ -6197,7 +6197,7 @@
#ifdef __QNXTARGET__
#define ELF_MAXPAGESIZE0x1000
#else
-#define ELF_MAXPAGESIZE0x1
+#define ELF_MAXPAGESIZE0x4
#endif
#define ELF_MINPAGESIZE0x1000
#define elf_info_to_howtoppc_elf_info_to_howto

And you need to rebuild the whole RFS with patched binutils of cause.

Regards, Ilya.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread Josh Boyer
On Thu, Sep 11, 2008 at 10:15:07PM +0400, Yuri Tikhonov wrote:
>> I think this help should mention that for page size 256KB, you will
>> need to have a special version of binutils, since the ELF standard
>> mentions page sizes only upto 64KB.
>
> Right. We use ELDK-4.2 for compiling applications to be run on 256K
>PAGE_SIZE kernel. This toolchain includes necessary changes for
>ELF_MAXPAGESIZE in binutils/bfd/elf32-ppc.c.

Ok, but not everyone does.  And I think setting the page size to this
should be harder, maybe even dependent upon CONFIG_BROKEN.

I need to look over the patch a bit more, but some of the comments you've
already gotten seem valid.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread prodyut hazarika
>
> Any comments on the issues mentioned in introductory message?
>

I am reviewing the changes more thoroughly. I will give additional
comments within the next 2-3 days.
I am working on putting similar support for 405EX (Kilauea board), but
having some issues.
I will post the patch after I am done with it.

Also, it would be great if you could point me what changes are
necessary to recompile the binutils.
I would like to test the 256KB changes on my Canyonlands board. I have
got 16KB/64KB working.

Regards,
Prodyut Hazarika
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread prodyut hazarika
>
> I think you missed first '-' on the first line.
>
I was not too careful :-)


>> I think these 44x specific defines should go to asm/mmu-44x.h since I
>>
>
> Agreed.
>
It would be great to have user-friendly names.
Also moving to the mmu-4xx specific header files hides the changes to 4xx files.


>> For 256KB page size, I cannot understand why PTE_SHIFT is 11. Since
>> each PTE entry is 8 byte, PTE_SHIFT should have been 15. But then
>> there would be no bits in the Effective address for the 1st level
>> PGDIR offset. On what basis PTE_SHIFT of 11 is chosen? This overflow
>> problem happens only for 256KB page size.
>>
>
> I think Yuri has commented on this already.
>
Thanks.

In file arch/powerpc/mm/pgtable_32.c, we have:

#ifdef CONFIG_PTE_64BIT
/* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */
#define PGDIR_ORDER 1
#else
#define PGDIR_ORDER 0
#endif
pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *ret;

ret = (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, PGDIR_ORDER);
return ret;
}

Thus, we allocate 2 pages for 44x processors for PGD. This is needed
only for 4K page.
We are anyway not using the whole 64K or 256K page for the PGD. So
there is no point to waste an additional 64K or 256KB page

Change this to:
#ifdef CONFIG_PTE_64BIT
#if (PAGE_SHIFT == 12)
/* 44x uses an 8kB pgdir because it has 8-byte Linux PTEs. */
#define PGDIR_ORDER 1
#else
#define PGDIR_ORDER 0
#endif
#else
#define PGDIR_ORDER 0
#endif
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread Ilya Yanok
Hi,

prodyut hazarika wrote:
>> +choice
>> +   prompt "Page size"
>> +   depends on 44x && PPC32
>> +   default PPC32_4K_PAGES
>> +   help
>> + The PAGE_SIZE definition. Increasing the page size may
>> + improve the system performance in some dedicated cases.
>> + If unsure, set it to 4 KB.
>> +
>> 
> You should mention an example of dedicated cases (eg. RAID).
> I think this help should mention that for page size 256KB, you will
> need to have a special version of binutils, since the ELF standard
> mentions page sizes only upto 64KB.
>   

Agreed.

>> -#ifdef CONFIG_PPC_64K_PAGES
>> +#if defined(CONFIG_PPC32_256K_PAGES)
>> +#define PAGE_SHIFT 18
>> +#elif defined(CONFIG_PPC32_64K_PAGES) || defined(CONFIG_PPC_64K_PAGES)
>>  #define PAGE_SHIFT 16
>> +#elif defined(CONFIG_PPC32_16K_PAGES)
>> +#define PAGE_SHIFT 14
>>  #else
>>  #define PAGE_SHIFT 12
>>  #endif
>> 
>
> Why should the new defines be inside CONFIG_PPC_64K_PAGES? The
>   

I think you missed first '-' on the first line.

> definition CONFIG_PPC_64K_PAGES is repeated.
> Shouldn't these defines be like this:
> #if defined(CONFIG_PPC32_256K_PAGES)
> #define PAGE_SHIFT 18
> #elif defined(CONFIG_PPC32_64K_PAGES) || defined(CONFIG_PPC_64K_PAGES)
> #define PAGE_SHIFT 16
> #elif defined(CONFIG_PPC32_16K_PAGES)
> #define PAGE_SHIFT 14
> #else
> #define PAGE_SHIFT 12
> #endif
>   

And they do actually :)

> Please change PPC44x_PGD_OFF_SH to PPC44x_PGD_OFF_SHIFT. SH sounds
> very confusing. I don't like the MI and M2 names too. Change
> PPC44x_RPN_M2 to PPC44x_RPN_MASK. Change M1 to MASK in
> PPC44x_PGD_OFF_M1 and PPC44x_PTE_ADD_M1 .
>   

Agreed.

> Is there no way a define like
> #define PPC44x_PGD_OFF_SH  (32 - PMD_SHIFT + 2)
> be used in assembly file. If yes, we can avoid repeating the defines.
>   

We can use defined like this, problem is that PMD_SHIFT and PTE_SHIFT
declared inside #ifndef __ASSEMBLY__

> I think these 44x specific defines should go to asm/mmu-44x.h since I
>   

Agreed.

> For 256KB page size, I cannot understand why PTE_SHIFT is 11. Since
> each PTE entry is 8 byte, PTE_SHIFT should have been 15. But then
> there would be no bits in the Effective address for the 1st level
> PGDIR offset. On what basis PTE_SHIFT of 11 is chosen? This overflow
> problem happens only for 256KB page size.
>   

I think Yuri has commented on this already.

Any comments on the issues mentioned in introductory message?

Regards, Ilya.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: add support for PAGE_SIZEs greater than 4KB for

2008-09-11 Thread prodyut hazarika
I was planning to post a similar patch. Good that you already posted
it :-) I will try to finish off similar patch for 40x processors.

>
> +choice
> +   prompt "Page size"
> +   depends on 44x && PPC32
> +   default PPC32_4K_PAGES
> +   help
> + The PAGE_SIZE definition. Increasing the page size may
> + improve the system performance in some dedicated cases.
> + If unsure, set it to 4 KB.
> +
You should mention an example of dedicated cases (eg. RAID).
I think this help should mention that for page size 256KB, you will
need to have a special version of binutils, since the ELF standard
mentions page sizes only upto 64KB.

> -#ifdef CONFIG_PPC_64K_PAGES
> +#if defined(CONFIG_PPC32_256K_PAGES)
> +#define PAGE_SHIFT 18
> +#elif defined(CONFIG_PPC32_64K_PAGES) || defined(CONFIG_PPC_64K_PAGES)
>  #define PAGE_SHIFT 16
> +#elif defined(CONFIG_PPC32_16K_PAGES)
> +#define PAGE_SHIFT 14
>  #else
>  #define PAGE_SHIFT 12
>  #endif

Why should the new defines be inside CONFIG_PPC_64K_PAGES? The
definition CONFIG_PPC_64K_PAGES is repeated.
Shouldn't these defines be like this:
#if defined(CONFIG_PPC32_256K_PAGES)
#define PAGE_SHIFT 18
#elif defined(CONFIG_PPC32_64K_PAGES) || defined(CONFIG_PPC_64K_PAGES)
#define PAGE_SHIFT 16
#elif defined(CONFIG_PPC32_16K_PAGES)
#define PAGE_SHIFT 14
#else
#define PAGE_SHIFT 12
#endif

> +#elif (PAGE_SHIFT == 14)
> +/*
> + * PAGE_SIZE  16K
> + * PAGE_SHIFT 14
> + * PTE_SHIFT  11
> + * PMD_SHIFT  25
> + */
> +#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*/

Please change PPC44x_PGD_OFF_SH to PPC44x_PGD_OFF_SHIFT. SH sounds
very confusing. I don't like the MI and M2 names too. Change
PPC44x_RPN_M2 to PPC44x_RPN_MASK. Change M1 to MASK in
PPC44x_PGD_OFF_M1 and PPC44x_PTE_ADD_M1 .
Is there no way a define like
#define PPC44x_PGD_OFF_SH  (32 - PMD_SHIFT + 2)
be used in assembly file. If yes, we can avoid repeating the defines.

I think these 44x specific defines should go to asm/mmu-44x.h since I
am planning to post a patch for 40x. For those processors, the defines
below will changes as:
#define PPC44x_PTE_ADD_SH  (32 - PMD_SHIFT + PTE_SHIFT + 2)
#define PPC44x_PTE_ADD_M1  (32 - 2 - PTE_SHIFT)
Since these defines are not generic, they should be put in the mmu
specific header file rather than adding a new header file. When 40x
processors are supported, the corresponding defines can go to
include/asm/mmu-40x.h

> +#elif (PAGE_SHIFT == 18)
> +/*
> + * PAGE_SIZE  256K
> + * PAGE_SHIFT 18
> + * PTE_SHIFT  11
> + * PMD_SHIFT  29
> + */
> +#define PPC44x_TLBE_SIZE   PPC44x_TLB_256K
> +#define PPC44x_PGD_OFF_SH  5  /*(32 - PMD_SHIFT + 2)*/
> +#define PPC44x_PGD_OFF_M1  27 /*(PMD_SHIFT - 2)*/
> +#define PPC44x_PTE_ADD_SH  17 /*32 - PMD_SHIFT + PTE_SHIFT + 3*/
> +#define PPC44x_PTE_ADD_M1  18 /*32 - 3 - PTE_SHIFT*/
> +#define PPC44x_RPN_M2  13 /*31 - PAGE_SHIFT*/

For 256KB page size, I cannot understand why PTE_SHIFT is 11. Since
each PTE entry is 8 byte, PTE_SHIFT should have been 15. But then
there would be no bits in the Effective address for the 1st level
PGDIR offset. On what basis PTE_SHIFT of 11 is chosen? This overflow
problem happens only for 256KB page size.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev