[PATCH v4] ARM: vexpress: add support for multiple core tiles

Will Deacon
2010-12-07T16:18:07Z

Hi Russell,

> > - /* sanity check */
> > - if (ncores > NR_CPUS) {
> > + ct_desc->init_cpu_map();
> > + if (!num_possible_cpus()) {
> > printk(KERN_WARNING
> > - "vexpress: no. of cores (%d) greater than configured "
> > - "maximum of %d - clipping\n",
> > - ncores, NR_CPUS);
> > - ncores = NR_CPUS;
> > + "vexpress: no possible CPUs declared, forcing logical "
> > + "CPU 0\n");
> > + set_cpu_possible(0, true);
>
> Hmm. The right check is whether the current CPU number is set in the
> possible map - if it's clear, then that's certainly a bug.
>
> However, this will never happen, unless you do something really silly
> in ->init_cpu_map() such as clearing all possible CPUs, or setting
> them false. See boot_cpu_init() in init/main.c.
>
> So I don't think we need this check (and I think it should be in the
> platform code.)

Ok, my initial thought was to lose the check as well. This means
that all we do in smp_init_cpus for vexpress is invoke
ct_desc->init_cpu_map().

> Alteratively, we could do this in the generic SMP code:
>
> if (num_possible_cpus() > NR_CPUS) {
> unsigned int nr = 0, cpu;
>
> pr_warning("SMP: number of CPUs greater than configured %u, disabling CPU",
> NR_CPUS);
>
> for_each_possible_cpu(cpu) {
> if (nr >= NR_CPUS) {
> cpu_set_possible(cpu, false);
> pr_cont(" %u", cpu);
> }
> nr++;
> }
> pr_cont("\n");
> }

Can num_possible_cpus() be > NR_CPUS? I think the bitmap used to calculate
the former is limited by the latter anyway.

Thanks,

Will