Re: [PATCH] smp: force all cpu to boot once under maxcpus option
From: Thomas Gleixner
Date: Mon Jul 22 2019 - 05:41:42 EST
On Wed, 10 Jul 2019, Pingfan Liu wrote:
>
> +static inline bool maxcpus_allowed(unsigned int cpu)
> +{
> + /* maxcpus only takes effect during system bootup */
> + if (smp_boot_done)
> + return true;
> + if (num_online_cpus() < setup_max_cpus)
> + return true;
> + /*
> + * maxcpus should allow cpu to set CR4.MCE asap, otherwise the set may
> + * be deferred indefinitely.
> + */
> + if (!per_cpu(cpuhp_state, cpu).booted_once)
> + return true;
As this is a x86 only issue, you cannot inflict this magic on every
architecture.
Aside of that this does not solve the problem at all because smp_init()
still does:
for_each_present_cpu(cpu) {
if (num_online_cpus() >= setup_max_cpus)
break;
if (!cpu_online(cpu))
cpu_up(cpu);
}
So the remaining CPUs are not onlined at all.
Thanks,
tglx