mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Byrne <daniel1.byrne@intel.com>
To: Ravi Jonnalagadda <ravis.opensrc@gmail.com>
Cc: Daniel Byrne <daniel1.byrne@intel.com>,
	Shivank Garg <shivankg@amd.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>, Zi Yan <ziy@nvidia.com>,
	Matthew Brost <matthew.brost@intel.com>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
	Gregory Price <gourry@gourry.net>,
	Ying Huang <ying.huang@linux.alibaba.com>,
	Alistair Popple <apopple@nvidia.com>,
	Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Karim Manaouil <kmanaouil.dev@gmail.com>,
	Frank van der Linden <fvdl@google.com>,
	Teja Vojjala <tejavojjala@google.com>,
	Pravin Tamkhane <pravintamkhane@google.com>,
	Kinsey Ho <kinseyho@google.com>, Wei Xu <weixugc@google.com>,
	Matthew Wilcox <willy@infradead.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Vinod Koul <vkoul@kernel.org>, Bharata B Rao <bharata@amd.com>,
	SeongJae Park <sj@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Xuezheng Chu <xuezhengchu@huawei.com>,
	Yiannis Nikolakopoulos <yiannis@zptcorp.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
	Rik van Riel <riel@surriel.com>,
	Shakeel Butt <shakeel.butt@linux.dev>, Tejun Heo <tj@kernel.org>,
	Fan Ni <nifan.cxl@gmail.com>, Jonathan Cameron <jic23@kernel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	Nathan Lynch <nathan.lynch@amd.com>, Frank Li <Frank.li@nxp.com>,
	Dan Williams <djbw@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Mike Day <michael.day@amd.com>,
	dmaengine@vger.kernel.org,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Frank Li <Frank.Li@kernel.org>, Dave Jiang <dave.jiang@intel.com>
Subject: Re: [PATCH RFC v6 4/5] drivers/migrate_offload: add DMA batch copy driver (dcbm)
Date: Tue,  1 Dec 2026 06:13:31 -0800	[thread overview]
Message-ID: <20261201141331.2124291-1-daniel1.byrne@intel.com> (raw)
In-Reply-To: <20261128225943.66318-1-ravis.opensrc@gmail.com>

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@intel.com/

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@intel.com

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

  parent reply	other threads:[~2026-12-01 14:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  7:28 [PATCH RFC v6 0/5] Accelerate page migration with batch copying and hardware offload Shivank Garg
2026-06-30  7:28 ` [PATCH RFC v6 1/5] mm/migrate: skip data copy for already-copied folios Shivank Garg
2026-06-30  7:28 ` [PATCH RFC v6 2/5] mm/migrate: add batch-copy path in migrate_pages_batch Shivank Garg
2026-06-30  7:28 ` [PATCH RFC v6 3/5] mm/migrate: add copy offload registration infrastructure Shivank Garg
2026-07-20 11:19   ` Huang, Ying
2026-07-20 14:44     ` Zi Yan
2026-07-20 15:32       ` Garg, Shivank
2026-07-20 15:45         ` Zi Yan
2026-07-21 11:32       ` Huang, Ying
2026-06-30  7:28 ` [PATCH RFC v6 4/5] drivers/migrate_offload: add DMA batch copy driver (dcbm) Shivank Garg
2026-11-28 22:59   ` Ravi Jonnalagadda
2026-11-28 23:12     ` Ravi Jonnalagadda
2026-12-01 14:13     ` Daniel Byrne [this message]
2026-06-30  7:28 ` [PATCH RFC v6 5/5] mm/migrate: adjust NR_MAX_BATCHED_MIGRATION for testing Shivank Garg
2026-07-14 11:29 ` [PATCH RFC v6 0/5] Accelerate page migration with batch copying and hardware offload Huang, Ying
2026-11-28 22:46 ` Ravi Jonnalagadda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201141331.2124291-1-daniel1.byrne@intel.com \
    --to=daniel1.byrne@intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=Frank.li@nxp.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=apopple@nvidia.com \
    --cc=bharata@amd.com \
    --cc=byungchul@sk.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=david@kernel.org \
    --cc=djbw@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=fvdl@google.com \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=jhubbard@nvidia.com \
    --cc=jic23@kernel.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kinseyho@google.com \
    --cc=kmanaouil.dev@gmail.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=michael.day@amd.com \
    --cc=nathan.lynch@amd.com \
    --cc=nifan.cxl@gmail.com \
    --cc=peterx@redhat.com \
    --cc=pravintamkhane@google.com \
    --cc=rakie.kim@sk.com \
    --cc=ravis.opensrc@gmail.com \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=shakeel.butt@linux.dev \
    --cc=shivankg@amd.com \
    --cc=sj@kernel.org \
    --cc=surenb@google.com \
    --cc=tejavojjala@google.com \
    --cc=tj@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=vkoul@kernel.org \
    --cc=weixugc@google.com \
    --cc=willy@infradead.org \
    --cc=xuezhengchu@huawei.com \
    --cc=yiannis@zptcorp.com \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®