powerpc: Use nr_cpu_ids in initial paca allocation
Now that we never set a cpu above nr_cpu_ids possible we can limit our initial paca allocation to nr_cpu_ids. We can then clamp the number of cpus in platforms/iseries/setup.c. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
committed by
Benjamin Herrenschmidt
parent
8657ae28dd
commit
2cd947f175
@@ -7,7 +7,7 @@
|
|||||||
* 2 of the License, or (at your option) any later version.
|
* 2 of the License, or (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/threads.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ static int __initdata paca_size;
|
|||||||
|
|
||||||
void __init allocate_pacas(void)
|
void __init allocate_pacas(void)
|
||||||
{
|
{
|
||||||
int nr_cpus, cpu, limit;
|
int cpu, limit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't take SLB misses on the paca, and we want to access them
|
* We can't take SLB misses on the paca, and we want to access them
|
||||||
@@ -190,23 +190,18 @@ void __init allocate_pacas(void)
|
|||||||
if (firmware_has_feature(FW_FEATURE_ISERIES))
|
if (firmware_has_feature(FW_FEATURE_ISERIES))
|
||||||
limit = min(limit, HvPagesToMap * HVPAGESIZE);
|
limit = min(limit, HvPagesToMap * HVPAGESIZE);
|
||||||
|
|
||||||
nr_cpus = NR_CPUS;
|
paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids);
|
||||||
/* On iSeries we know we can never have more than 64 cpus */
|
|
||||||
if (firmware_has_feature(FW_FEATURE_ISERIES))
|
|
||||||
nr_cpus = min(64, nr_cpus);
|
|
||||||
|
|
||||||
paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus);
|
|
||||||
|
|
||||||
paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit));
|
paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit));
|
||||||
memset(paca, 0, paca_size);
|
memset(paca, 0, paca_size);
|
||||||
|
|
||||||
printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n",
|
printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n",
|
||||||
paca_size, nr_cpus, paca);
|
paca_size, nr_cpu_ids, paca);
|
||||||
|
|
||||||
allocate_lppacas(nr_cpus, limit);
|
allocate_lppacas(nr_cpu_ids, limit);
|
||||||
|
|
||||||
/* Can't use for_each_*_cpu, as they aren't functional yet */
|
/* Can't use for_each_*_cpu, as they aren't functional yet */
|
||||||
for (cpu = 0; cpu < nr_cpus; cpu++)
|
for (cpu = 0; cpu < nr_cpu_ids; cpu++)
|
||||||
initialise_paca(&paca[cpu], cpu);
|
initialise_paca(&paca[cpu], cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -685,6 +685,11 @@ void * __init iSeries_early_setup(void)
|
|||||||
powerpc_firmware_features |= FW_FEATURE_ISERIES;
|
powerpc_firmware_features |= FW_FEATURE_ISERIES;
|
||||||
powerpc_firmware_features |= FW_FEATURE_LPAR;
|
powerpc_firmware_features |= FW_FEATURE_LPAR;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
/* On iSeries we know we can never have more than 64 cpus */
|
||||||
|
nr_cpu_ids = max(nr_cpu_ids, 64);
|
||||||
|
#endif
|
||||||
|
|
||||||
iSeries_fixup_klimit();
|
iSeries_fixup_klimit();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user