Re: [RFC][PATCH v2 08/10] smp,irq_work: Use the new irq_work API

From: Christoph Hellwig
Date: Wed Sep 09 2020 - 04:06:07 EST

On Thu, Aug 20, 2020 at 03:40:01PM +0200, peterz@xxxxxxxxxxxxx wrote:
> Anyway, tl;dr, what do we actually want? Do we favour the embedded
> irq_work variant over smp_call_function_single_asyn() ?

For blk-mq we really like an embedded structure that allows to bounce
the work to another CPU using IPIs.

> There's a few subtle differences, where smp_call_function_single_async()
> will directly call @func when @cpu == smp_processor_id(),
> irq_work_remote will give you WARN -- since irq_work to the local CPU is
> defined as a self-IPI, which isn't implemented on all architectures and
> is a distinctly different behaviour.

For the block code we handle the self case explicitly as it allows us
to optimize further and avoid an indirect call. That being said we
don't do a preempt_disable for that any more, as completing on the
"wrong" CPU for a just migrated completion handler is at worst a
performance degration but not a functional issue. So instead of the
warn we'd at least like an error return that allows to directly call
the completion handler.