Re: [PATCH RFC v6 4/5] drivers/migrate_offload: add DMA batch copy driver (dcbm)

From: Daniel Byrne

Date: Tue Dec 01 2026 - 09:20:26 EST


On Sat, 28 Nov 2026 22:59:43 +0000, Ravi Jonnalagadda wrote:
> Question: would you include this check in v7 to handle unordered
> providers (Intel DSA) until device_prep_dma_memcpy_sg() lands, while
> keeping a single interrupt per channel list on ordered providers?

Hi Ravi, Shivank,

I run dcbm on DSA as well, on top of v6, and hit the same three things.
Two of them are dmaengine matters that I have series for, so here are
some pointers before v7.

On the check: DMA_COMPLETION_NO_ORDER is going away in my polled-status
series, together with DMA_OUT_OF_ORDER:

https://lore.kernel.org/dmaengine/20261019150632.4026424-1-daniel1.byrne@xxxxxxxxx/

With that series idxd answers the status of every cookie from the
descriptor's own completion record. A client can wait for each
descriptor of a batch, with an interrupt or by polling. A descriptor
without DMA_PREP_INTERRUPT is retired by the query that sees it end, so
the work queue no longer fills up. v2 of it is in preparation. It gives
a provider a flag that says its status is per descriptor, and a client
like dcbm can test that where it would test DMA_COMPLETION_NO_ORDER
today.

In my copy of dcbm every descriptor has its own completion on every
provider, counted down on a pending counter as in your diff. That needs
no test at all, at the price of an interrupt per descriptor on an
ordered provider.

> Question: since dcbm needs to handle provider removal with either
> channel model, would you and Vinod prefer a DMAengine core callback
> that notifies channel holders before channel unregister / work-queue
> disable, or client-side bus notifiers in dcbm as above?

I hold the channels too, and I have a third variant for this. It is not
posted yet. The core marks a channel that its provider removes under
clients as detached. The channel takes no new work, what is outstanding
on it ends with an error, and its memory stays until the last client
releases it. The client tests dma_chan_detached() where it uses the
channel and lets go of it then. That needs no callback into the client
under the provider's locks, and the client does not have to know the
provider's bus.

It goes on top of the two helpers of this series, which is on the list:

https://lore.kernel.org/r/20261130195203.1901143-1-daniel1.byrne@xxxxxxxxx

Today idxd warns and then frees the channel under a client that still
holds it when the queue is unbound, which is the warning you saw.

> Question: when failed channels cannot be replaced after a timeout,
> which should dcbm do?

On DSA I ended up never terminating from dcbm. terminate_all acts on the
whole channel, so on a held, shared channel it ends the other batches
too. A device whose completions are overdue takes no new work until
everything out on it has landed, and the CPU copies meanwhile. A halted
DSA device completes what it held with an error, so that ends with the
device's own recovery.

> And should MR_NUMA_MISPLACED stay out of offload until failures are
> detected sooner

I leave NUMA hinting faults out by default, for the reason you give.

For device_prep_dma_memcpy_sg() I have an idxd implementation on DSA
batch descriptors. It is not posted either, in case it helps the
comparison.

I think it would be best to merge my dcbm changes with a v7 and with
yours instead of posting yet another variant. So that you can see my
changes now, I am sending the dcbm part as an RFC on top of v6. It
applies on v7.4-rc2 and does not need my dmaengine series. The patches
that do need my dmaengine series, the detached channels and the
idxd memcpy_sg among it, will follow with those series.

Shivank, you can take from the RFC what fits v7, and
let me know if you need any changes.

Thanks,
Daniel