Re: [PATCH] powerpc: Use more accurate limit for first segment memory allocations

2010-05-11 Thread Michael Ellerman
On Tue, 2010-05-11 at 14:59 +1000, Anton Blanchard wrote:
 Author: Milton Miller milt...@bga.com
 
 On large machines we are running out of room below 256MB. In some cases we
 only need to ensure the allocation is in the first segment, which may be
 256MB or 1TB.
 
 Add slb0_limit and use it to specify the upper limit for the irqstack and
 emergency stacks.
 
 On a large ppc64 box, this fixes a panic at boot when the crashkernel=
 option is specified (previously we would run out of memory below 256MB).
 
 Signed-off-by: Milton Miller milt...@bga.com
 Signed-off-by: Anton Blanchard an...@samba.org
 ---
 
 Some things we should add:
 
 - Specify a more intelligent limit for BookE
 - The allocation of the PACAs should use this limit too

We access the PACA from real mode?

 Index: linux-2.6/arch/powerpc/kernel/setup_64.c
 ===
 --- linux-2.6.orig/arch/powerpc/kernel/setup_64.c 2010-04-22 
 17:23:42.0 +1000
 +++ linux-2.6/arch/powerpc/kernel/setup_64.c  2010-04-30 09:46:15.0 
 +1000
 @@ -424,9 +424,18 @@ void __init setup_system(void)
   DBG( - setup_system()\n);
  }
  
 +static u64 slb0_limit(void)
 +{
 + if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
 + return 1UL  SID_SHIFT_1T;
 + }
 + return 1UL  SID_SHIFT;
 +}

I take it there's no chance the CPU feature is there but we're using 256
for whatever reason?

cheers



signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] powerpc: Use more accurate limit for first segment memory allocations

2010-05-10 Thread Anton Blanchard
Author: Milton Miller milt...@bga.com

On large machines we are running out of room below 256MB. In some cases we
only need to ensure the allocation is in the first segment, which may be
256MB or 1TB.

Add slb0_limit and use it to specify the upper limit for the irqstack and
emergency stacks.

On a large ppc64 box, this fixes a panic at boot when the crashkernel=
option is specified (previously we would run out of memory below 256MB).

Signed-off-by: Milton Miller milt...@bga.com
Signed-off-by: Anton Blanchard an...@samba.org
---

Some things we should add:

- Specify a more intelligent limit for BookE
- The allocation of the PACAs should use this limit too

Index: linux-2.6/arch/powerpc/kernel/setup_64.c
===
--- linux-2.6.orig/arch/powerpc/kernel/setup_64.c   2010-04-22 
17:23:42.0 +1000
+++ linux-2.6/arch/powerpc/kernel/setup_64.c2010-04-30 09:46:15.0 
+1000
@@ -424,9 +424,18 @@ void __init setup_system(void)
DBG( - setup_system()\n);
 }
 
+static u64 slb0_limit(void)
+{
+   if (cpu_has_feature(CPU_FTR_1T_SEGMENT)) {
+   return 1UL  SID_SHIFT_1T;
+   }
+   return 1UL  SID_SHIFT;
+}
+
 #ifdef CONFIG_IRQSTACKS
 static void __init irqstack_early_init(void)
 {
+   u64 limit = slb0_limit();
unsigned int i;
 
/*
@@ -436,10 +445,10 @@ static void __init irqstack_early_init(v
for_each_possible_cpu(i) {
softirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc_base(THREAD_SIZE,
-   THREAD_SIZE, 0x1000));
+   THREAD_SIZE, limit));
hardirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc_base(THREAD_SIZE,
-   THREAD_SIZE, 0x1000));
+   THREAD_SIZE, limit));
}
 }
 #else
@@ -470,7 +479,7 @@ static void __init exc_lvl_early_init(vo
  */
 static void __init emergency_stack_init(void)
 {
-   unsigned long limit;
+   u64 limit;
unsigned int i;
 
/*
@@ -482,7 +491,7 @@ static void __init emergency_stack_init(
 * bringup, we need to get at them in real mode. This means they
 * must also be within the RMO region.
 */
-   limit = min(0x1000ULL, lmb.rmo_size);
+   limit = min(slb0_limit(), lmb.rmo_size);
 
for_each_possible_cpu(i) {
unsigned long sp;
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev