eliminate spurious pointless WARN_ON()s
PATCH 1/1 eliminate spurious pointless WARN_ON()s
Namely during early boot, the panic() or BUG() paths may end up in smp_call_function_*() with just a single online CPU. In that situation the warnings generated are not only meaningless, but also result in relevant output being cluttered.
Therefore, defer the WARN_ON() checks until after the (unaffected from the problem that is being attempted to be detected here) cases have been handled.
--- kernel/smp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/smp.c +6 -6
@@ -222,9 +222,6 @@ int smp_call_function_single(int cpu, voint me =get_cpu ();int err =0 ; -/* Can deadlock when called with interrupts disabled */ -WARN_ON (irqs_disabled ()); -if (cpu == me) {local_irq_save (flags);func (info);
@@ -232,6 +229,9 @@ int smp_call_function_single(int cpu, vo }else if ((unsigned )cpu < nr_cpu_ids &&cpu_online (cpu)) {struct call_single_data *data; +/* Can deadlock when called with interrupts disabled */ +WARN_ON (irqs_disabled ()); +if (!wait) {/* * We are calling a function on a single CPU
@@ -325,9 +325,6 @@ void smp_call_function_many(const structunsigned long flags;int cpu, next_cpu; -/* Can deadlock when called with interrupts disabled */ -WARN_ON (irqs_disabled ()); -/* So, what's a CPU they want? Ignoring this one. */ cpu =cpumask_first_and (mask, cpu_online_mask);if (cpu ==smp_processor_id ())
@@ -347,6 +344,9 @@ void smp_call_function_many(const structreturn ; } +/* Can deadlock when called with interrupts disabled */ +WARN_ON (irqs_disabled ()); + data =kmalloc (sizeof (*data) +cpumask_size (),GFP_ATOMIC );if (unlikely (!data)) {/* Slow path. */
Quoted 9 lines · Jan Beulich
Namely during early boot, the
panic()orBUG()paths may end up in smp_call_function_*() with just a single online CPU. In that situation the warnings generated are not only meaningless, but also result in relevant output being cluttered.Therefore, defer the
WARN_ON()checks until after the (unaffected from the problem that is being attempted to be detected here) cases have been handled.
Makes sense probably - but please send a patch against -tip as we've got quite many changes queued up in that area and your patch does not apply cleanly:
patching file kernel/smp.c
Hunk #1 FAILED at 222.
Hunk #2 FAILED at 229.
Hunk #3 FAILED at 325.
Hunk #4 FAILED at 344.
4 out of 4 hunks FAILED -- rejects in file kernel/smp.c
Thanks,
Ingo