Re: [PATCH v5 UPDATEDv2 3/3] CPU hotplug, smp: Flush any pending IPI callbacks before CPU offline

From: Srivatsa S. Bhat
Date: Mon May 19 2014 - 15:51:19 EST


On 05/19/2014 09:48 PM, Oleg Nesterov wrote:
> On 05/19, Srivatsa S. Bhat wrote:
>>
>> However, an IPI sent much earlier might arrive late on the target CPU
>> (possibly _after_ the CPU has gone offline) due to hardware latencies,
>> and due to this, the smp-call-function callbacks queued on the outgoing
>> CPU might not get noticed (and hence not executed) at all.
>
> OK, but
>
>> +void flush_smp_call_function_queue(void)
>> +{
>> + struct llist_head *head;
>> + struct llist_node *entry;
>> + struct call_single_data *csd, *csd_next;
>> +
>> + WARN_ON(!irqs_disabled());
>> +
>> + head = &__get_cpu_var(call_single_queue);
>> +
>> + if (likely(llist_empty(head)))
>> + return;
>> +
>> + entry = llist_del_all(head);
>> + entry = llist_reverse_order(entry);
>> +
>> + llist_for_each_entry_safe(csd, csd_next, entry, llist) {
>> + csd->func(csd->info);
>> + csd_unlock(csd);
>> + }
>> +}
>
> why do we need it? Can't multi_cpu_stop() just call
> generic_smp_call_function_single_interrupt() ? This cpu is still online,
> we should not worry about WARN_ON(!cpu_online()) ?
>

Ah, cool idea! :-) I'll use this method and post an updated patch.

Thank you!

Regards,
Srivatsa S. Bhat

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/