Re: [PATCH v2] kernel/isolation: Assert that a housekeeping CPU comes up at boot time

From: Frederic Weisbecker
Date: Mon Jun 24 2019 - 21:11:58 EST


On Tue, Jun 25, 2019 at 10:17:20AM +1000, Nicholas Piggin wrote:
> +static int __init housekeeping_verify_smp(void)
> +{
> + int cpu;
> +
> + if (!housekeeping_flags)
> + return 0;
> +
> + /*
> + * Early housekeeping setup is done before CPUs come up, and there are
> + * a range of options scattered around that can restrict which CPUs
> + * come up. It is possible to pass in a combination of housekeeping
> + * and SMP arguments that result in housekeeping assigned to an
> + * offline CPU.
> + *
> + * Check that condition here after SMP comes up, and give a useful
> + * error message rather than an obscure non deterministic crash or
> + * hang later.
> + */
> + for_each_online_cpu(cpu) {
> + if (cpumask_test_cpu(cpu, housekeeping_mask))
> + return 0;
> + }
> + panic("Housekeeping: nohz_full= or isolcpus= resulted in no online CPUs for housekeeping.\n");

Ok let's keep the panic. But let's simplify and spare long iterations off boot load:

if (!cpumask_intersects(cpu_online_mask, housekeeping_mask))
panic(...);

Thanks.