]> git.baikalelectronics.ru Git - kernel.git/commitdiff
smp: Fix offline cpu check in flush_smp_call_function_queue()
authorNadav Amit <namit@vmware.com>
Sat, 19 Mar 2022 07:20:15 +0000 (00:20 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 13 Apr 2022 16:44:35 +0000 (18:44 +0200)
The check in flush_smp_call_function_queue() for callbacks that are sent
to offline CPUs currently checks whether the queue is empty.

However, flush_smp_call_function_queue() has just deleted all the
callbacks from the queue and moved all the entries into a local list.
This checks would only be positive if some callbacks were added in the
short time after llist_del_all() was called. This does not seem to be
the intention of this check.

Change the check to look at the local list to which the entries were
moved instead of the queue from which all the callbacks were just
removed.

Fixes: 7583bb5c1067e ("CPU hotplug, smp: flush any pending IPI callbacks before CPU offline")
Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20220319072015.1495036-1-namit@vmware.com
kernel/smp.c

index 01a7c1706a58b1df8724f8afc49b4a3a46919bcd..65a630f62363c2a04588e0f7bcf328548b820ca1 100644 (file)
@@ -579,7 +579,7 @@ static void flush_smp_call_function_queue(bool warn_cpu_offline)
 
        /* There shouldn't be any pending callbacks on an offline CPU. */
        if (unlikely(warn_cpu_offline && !cpu_online(smp_processor_id()) &&
-                    !warned && !llist_empty(head))) {
+                    !warned && entry != NULL)) {
                warned = true;
                WARN(1, "IPI on offline CPU %d\n", smp_processor_id());