Commit a6cb92f2 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: dynamically allocate emergency stacks

Now we set up cpu_possible_map early we can dynamically allocate the
emergency stacks.  Previously we would allocate NR_CPUS * PAGE_SIZE,
potentially wasting quite a lot of memory.

Clean a comment up in irqstack_early_init and use unsigned int for cpu ids
while in the area.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c4e944c3
......@@ -27,13 +27,6 @@ struct systemcfg *systemcfg;
* field correctly */
extern unsigned long __toc_start;
/* Stack space used when we detect a bad kernel stack pointer, and
* early in SMP boots before relocation is enabled.
*
* ABI requires stack to be 128-byte aligned
*/
char emergency_stack[PAGE_SIZE * NR_CPUS] __attribute__((aligned(128)));
/* The Paca is an array with one entry per processor. Each contains an
* ItLpPaca, which contains the information shared between the
* hypervisor and Linux. Each also contains an ItLpRegSave area which
......@@ -55,7 +48,6 @@ char emergency_stack[PAGE_SIZE * NR_CPUS] __attribute__((aligned(128)));
.kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
.stab_real = (asrr), /* Real pointer to segment table */ \
.stab_addr = (asrv), /* Virt pointer to segment table */ \
.emergency_sp = &emergency_stack[((number)+1) * PAGE_SIZE], \
.cpu_start = (start), /* Processor start */ \
.lppaca = { \
.xDesc = 0xd397d781, /* "LpPa" */ \
......
......@@ -701,9 +701,12 @@ extern void (*calibrate_delay)(void);
#ifdef CONFIG_IRQSTACKS
static void __init irqstack_early_init(void)
{
int i;
unsigned int i;
/* interrupt stacks must be under 256MB, we cannot afford to take SLB misses on them */
/*
* interrupt stacks must be under 256MB, we cannot afford to take
* SLB misses on them.
*/
for_each_cpu(i) {
softirq_ctx[i] = (struct thread_info *)__va(lmb_alloc_base(THREAD_SIZE,
THREAD_SIZE, 0x10000000));
......@@ -715,6 +718,24 @@ static void __init irqstack_early_init(void)
#define irqstack_early_init()
#endif
/*
* Stack space used when we detect a bad kernel stack pointer, and
* early in SMP boots before relocation is enabled.
*/
static void __init emergency_stack_init(void)
{
unsigned int i;
/*
* Emergency stacks must be under 256MB, we cannot afford to take
* SLB misses on them. The ABI also requires them to be 128-byte
* aligned.
*/
for_each_cpu(i)
paca[i].emergency_sp = __va(lmb_alloc_base(PAGE_SIZE, 128,
0x10000000)) + PAGE_SIZE;
}
/*
* Called into from start_kernel, after lock_kernel has been called.
* Initializes bootmem, which is unsed to manage page allocation until
......@@ -761,6 +782,7 @@ void __init setup_arch(char **cmdline_p)
*cmdline_p = cmd_line;
irqstack_early_init();
emergency_stack_init();
/* set up the bootmem stuff with available memory */
do_init_bootmem();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment