powerpc 8xx: Fixing memory init issue with CONFIG_PIN_TLB
PATCH 1/1 powerpc 8xx: Fixing memory init issue with CONFIG_PIN_TLB
Activating CONFIG_PIN_TLB allows access to the 24 first Mbytes of memory at bootup instead of 8. It is needed for "big" kernels for instance when activating CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account in init_32 too, otherwise memory allocation soon fails after startup.
arch/powerpc/mm/init_32.c +5 -0
@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ +memblock_set_current_limit (min_t (u64, first_memblock_size,0x01800000 )); +#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit (min_t (u64, first_memblock_size,0x00800000 )); +#endif }#endif /* CONFIG_8xx */
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org> wrote on 2013/10/11 14:56:40:
Quoted 2 lines
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of memory
at
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance when
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account ininit_32
too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.S
Quoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-02
22:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09 11:28:54.000000000
+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));
arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));
arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */
hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and do the same
in head_8xx.S.
Or to keep it simple, just always map at least 16 MB here and in head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.
Much of the need for pinning would go away if you adopted my 8MB pages from 2.4 to 3.x
Jocke
Quoted 34 lines · Joakim Tjernlund
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org> wrote on 2013/10/11 14:56:40:
Quoted 1 line
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of memoryat
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance when
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account ininit_32too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.SQuoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-0222:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09 11:28:54.000000000+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */
Quoted 7 lines
hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and do the same
inhead_8xx.S.Or to keep it simple, just always map at least 16 MB here and in
head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.
Yes we could do a more elaborated modification in the future. However it also has an impact on the boot loader, so I'm not sure we should make it the default without thinking twice.
In the meantime, my patch does take into account the existing situation where you have 8Mb by default and 24Mb when you activate CONFIG_PIN_TLB. I see it as a bug fix and I believe we should include it at least in order to allow including in the stable releases.
Do you see any issue with this approach ?
Quoted 6 lines
Much of the need for pinning would go away if you adopted my 8MB pages from 2.4 to 3.x
Jocke
Christophe
Joakim Tjernlund
Acked-byleroy christophe <[email protected]> wrote on 2013/10/15 18:27:00:
Quoted 7 lines · Joakim Tjernlund
Quoted 4 lines
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org> wrote on 2013/10/11 14:56:40:
Quoted 1 line
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of
memory
Quoted 4 lines
Quoted 4 lines
at
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance when
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account in
init_32
Quoted 10 lines
Quoted 10 lines
too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.SQuoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-0222:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09
11:28:54.000000000
Quoted 9 lines
Quoted 9 lines
+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));
Quoted 8 lines
Quoted 8 lines
arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */ hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and
do
Quoted 10 lines
Quoted 6 lines
the same
inhead_8xx.S.Or to keep it simple, just always map at least 16 MB here and in
head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.Yes we could do a more elaborated modification in the future. However it
also has an impact on the boot loader, so I'm not sure we should make it
Quoted 8 lines
the default without thinking twice.
In the meantime, my patch does take into account the existing situation where you have 8Mb by default and 24Mb when you activate
CONFIG_PIN_TLB. I see it as a bug fix and I believe we should include it at least in order to allow including in the stable releases.Do you see any issue with this approach ?
Not at all, so:
Quoted 3 lines · leroy christophe
Le 11/10/2013 17:13, Joakim Tjernlund a =C3=A9crit :
Quoted 2 lines
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=3Dtransmode.se@lists.ozlabs.or=
g>
Quoted 2 lines
Quoted 2 lines
wrote on 2013/10/11 14:56:40:
Quoted 1 line
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of me=
mory
Quoted 2 lines
Quoted 2 lines
at
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance whe=
n
Quoted 2 lines
Quoted 2 lines
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account in init_=
32
Quoted 10 lines
Quoted 10 lines
too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.SQuoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-0222:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09 11:28:54.00000=
0000
Quoted 9 lines
Quoted 9 lines
+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON(first_memblock_base !=3D 0); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));
Quoted 8 lines
Quoted 8 lines
arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */ hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and=
do
Quoted 7 lines
Quoted 6 lines
the same
inhead_8xx.S.Or to keep it simple, just always map at least 16 MB here and in
head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.Yes we could do a more elaborated modification in the future. However i=
t=20
Quoted 1 line
also has an impact on the boot loader, so I'm not sure we should make i=
t=20
Quoted 3 lines
the default without thinking twice.
=20
In the meantime, my patch does take into account the existing situation=
=20
Quoted 1 line
where you have 8Mb by default and 24Mb when you activate
CONFIG_PIN_TLB=
.
Quoted 4 lines
I see it as a bug fix and I believe we should include it at least in=20 order to allow including in the stable releases.
=20
Do you see any issue with this approach ?
The patch is fine, but I don't think it's stable material (BTW, if it were, you should have marked it as such when submitting). If I understand the situation correctly, there's no regression, and nothing fails to work with CONFIG_PIN_TLB that would have worked without it. It's just making CONFIG_PIN_TLB more useful.
-Scott
Quoted 52 lines · Scott Wood
Quoted 51 lines · leroy christophe
Quoted 34 lines · Joakim Tjernlund
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org> wrote on 2013/10/11 14:56:40:
Quoted 1 line
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of memoryat
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance when
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account ininit_32too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.SQuoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-0222:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09 11:28:54.000000000+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */ Quoted 7 lines
hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and do the same
inhead_8xx.S.Or to keep it simple, just always map at least 16 MB here and in
head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.Yes we could do a more elaborated modification in the future. However it also has an impact on the boot loader, so I'm not sure we should make it the default without thinking twice.
In the meantime, my patch does take into account the existing situation where you have 8Mb by default and 24Mb when you activate
CONFIG_PIN_TLB. I see it as a bug fix and I believe we should include it at least in order to allow including in the stable releases.
Quoted 8 lines
Quoted 1 line
Do you see any issue with this approach ?
The patch is fine, but I don't think it's stable material (BTW, if it were, you should have marked it as such when submitting). If I understand the situation correctly, there's no regression, and nothing fails to work with
CONFIG_PIN_TLBthat would have worked without it. It's just makingCONFIG_PIN_TLBmore useful.
Yes the patch is definitly stable. How should I have mark it ?
The situation is that in 2010, I discovered that I was not able to start a big Kernel because of the 8Mb limit.
You told me (see attached mail) that in order to get rid of that limit I shall use CONFIG_PIN_TLB: it was the first step, it helped pass the memory zeroize at init, but it was not enough as I then got problems with the Device Tree being erased because being put inside the first 8Mb area too. Then I temporarely gave up at that time.
Recently I started again. After fixing my bootloader to get the device tree somewhere else, I discovered this 8Mb limit hardcoded in mm/init_32.c for the 8xx With the patch I submitted I can now boot a kernel which is bigger than 8Mb.
So, I'm a bit lost here on what to do.
Quoted 46 lines · leroy christophe
Quoted 34 lines · Joakim Tjernlund
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org> wrote on 2013/10/11 14:56:40:
Quoted 1 line
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of memoryat
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance when
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account ininit_32too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.SQuoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-0222:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09 11:28:54.000000000+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */ Quoted 7 lines
hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and do the same
inhead_8xx.S.Or to keep it simple, just always map at least 16 MB here and in
head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.Yes we could do a more elaborated modification in the future. However it also has an impact on the boot loader, so I'm not sure we should make it the default without thinking twice.
Quoted 6 lines
In the meantime, my patch does take into account the existing situation where you have 8Mb by default and 24Mb when you activate
CONFIG_PIN_TLB. I see it as a bug fix and I believe we should include it at least in order to allow including in the stable releases.Do you see any issue with this approach ?
The patch is fine, but I don't think it's stable material (BTW, if it were, you should have marked it as such when submitting). If I understand the situation correctly, there's no regression, and nothing fails to work with CONFIG_PIN_TLB that would have worked without it. It's just making CONFIG_PIN_TLB more useful.
-Scott
Quoted 54 lines · leroy christophe
Quoted 53 lines · Scott Wood
Quoted 52 lines · leroy christophe
Quoted 34 lines · Joakim Tjernlund
"Linuxppc-dev" <linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org> wrote on 2013/10/11 14:56:40:
Quoted 1 line
Activating
CONFIG_PIN_TLBallows access to the 24 first Mbytes of memoryat
Quoted 1 line
bootup instead of 8. It is needed for "big" kernels for instance when
activating
Quoted 1 line
CONFIG_LOCKDEP_SUPPORT. This needs to be taken into account ininit_32too,
Quoted 5 lines
otherwise memory allocation soon fails after startup.
Signed-off-by Christophe Leroy <[email protected]>diff -ur
linux-3.11.org/arch/powerpc/kernel/head_8xx.S
linux-3.11/arch/powerpc/kernel/head_8xx.SQuoted 1 line
---
linux-3.11.org/arch/powerpc/mm/init_32.c2013-09-0222:46:10.000000000 +0200
Quoted 1 line
+++
linux-3.11/arch/powerpc/mm/init_32.c2013-09-09 11:28:54.000000000+0200
arch/powerpc/mm/init_32.c line 218
Quoted 7 lines
arch/powerpc/mm/init_32.c +3
-0@@ -213,7 +213,12 @@*/ BUG_ON (first_memblock_base !=0 ); +#ifdef CONFIG_PIN_TLB +/* 8xx can only access 24MB at the moment */ + memblock_set_current_limit(min_t(u64, first_memblock_size,
0x01800000));arch/powerpc/mm/init_32.c
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#else /* 8xx can only access 8MB at the moment */ memblock_set_current_limit(min_t(u64, first_memblock_size,
0x00800000));arch/powerpc/mm/init_32.c line 224
Quoted 3 lines
arch/powerpc/mm/init_32.c +1
-0+#endif }#endif /* CONFIG_8xx */ Quoted 7 lines
hmm, I think you should always map 24 MB (or less if RAM < 24 MB) and do the same
inhead_8xx.S.Or to keep it simple, just always map at least 16 MB here and in
head_8xx.S, assuming
that 16 MB is min RAM for any 8xx system running 3.x kernels.Yes we could do a more elaborated modification in the future. However it also has an impact on the boot loader, so I'm not sure we should make it the default without thinking twice.
In the meantime, my patch does take into account the existing situation where you have 8Mb by default and 24Mb when you activate
CONFIG_PIN_TLB. I see it as a bug fix and I believe we should include it at least in order to allow including in the stable releases.Do you see any issue with this approach ?
Quoted 8 lines
Quoted 7 lines
The patch is fine, but I don't think it's stable material (BTW, if it were, you should have marked it as such when submitting). If I understand the situation correctly, there's no regression, and nothing fails to work with
CONFIG_PIN_TLBthat would have worked without it. It's just makingCONFIG_PIN_TLBmore useful.Yes the patch is definitly stable.
It's not about whether the patch itself is "stable", but whether it is a critical bugfix that should be applied to the 3.11.x stable tree and the 3.12 release, rather than being queued for 3.13.
Quoted 1 line
How should I have mark it ?
https://www.kernel.org/doc/Documentation/stable_kernel_rules.txt
Quoted 8 lines
The situation is that in 2010, I discovered that I was not able to start a big Kernel because of the 8Mb limit.
You told me (see attached mail) that in order to get rid of that limit I shall useCONFIG_PIN_TLB: it was the first step, it helped pass the memory zeroize at init, but it was not enough as I then got problems with the Device Tree being erased because being put inside the first 8Mb area too. Then I temporarely gave up at that time.
Quoted 6 lines
Recently I started again. After fixing my bootloader to get the device tree somewhere else, I discovered this 8Mb limit hardcoded in
mm/init_32.cfor the 8xx
With the patch I submitted I can now boot a kernel which is bigger than 8Mb.So, I'm a bit lost here on what to do.
There's nothing you need to do -- I'll apply the patch and send it to Ben for 3.13.
-Scott