All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/7] Tiny steps towards amdgpu checkpoint and restore
@ 2026-10-19 13:01 Tvrtko Ursulin
  2026-10-19 13:01 ` [PATCH v4 1/7] drm/amdgpu: Check correct field in amdgpu_ttm_tt_is_userptr() Tvrtko Ursulin
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Tvrtko Ursulin @ 2026-10-19 13:01 UTC (permalink / raw)
  To: amd-gfx
  Cc: kernel-dev, David Francis, Christian König, Alex Deucher,
	Felix Kuehling, Tvrtko Ursulin

I am sending this early with the main goal of getting a feel on how it will be
received etc.

Cover letter is written mostly for people who already know what checkpoint and
restore is, so I will just restate the high level goal - To be able to
checkpoint and restore purely a rendernode process (so no kfd in the picture).

And for people not too familiar what it is, probably best to first read about it
here: https://criu.org/Main_Page.

There are three pieces of work here:

1.
This kernel series which adds new uapi to amdgpu.

2.
A new IGT test case which helped me find what doesn't work and to verify what I
added.

https://cgit.freedesktop.org/~tursulin/intel-gpu-tools/log/?h=amd-criu

The IGT starts out adding some very basic tests (first commit) which are laid
out in order of increasing complexity.

Following commits then add more tests and by the end, with all these series
combined, they all pass apart from the forking subtest. But that one I am
leaving out of scope for now.

(And to be clear, before this work, none of the tests cases can pass.)

3.
Changes to the amdgpu CRIU plugin which use the above uapi, among other changes.

https://github.com/tursulin/criu/pull/new/amdgpu-render-node-rfc

As a picture is worth a thousand words the best I can do is some from terminal
pastes showing it all in action.

Terminal 1:

$ sudo ~/build-holo/tests/amdgpu/amd_criu --r busy-client-content
IGT-Version: 2.3-ge37a85b91 (x86_64) (Linux: 7.1.0-rc2-cfs x86_64)
Using IGT_SRANDOM=1779805687 for randomisation
Opened device: /dev/dri/renderD128
Starting subtest: busy-client-content
Start checkpointing within 10 seconds...

Now switch to terminal 2:

$ sudo /usr/local/sbin/criu dump -t `pgrep amd_criu | head -1` \
  -L /usr/local/lib/criu/ -vvv -o criu.log -j --link-remap --tcp-established \
  --file-locks --ext-unix-sk

Back to terminal 1:

...
Killed # This is normal - CRIU dump has saved and terminated the process

Back to terminal 2, lets restore it:

$ sudo /usr/local/sbin/criu restore  -L /usr/local/lib/criu/ -vvv \
  -o restore.log --shell-job --link-remap --tcp-established --file-locks 
  --ext-unix-sk
Subtest busy-client-content: SUCCESS (10.739s)

And that is it. Client which was busy looping submitting a SDMA_NOP IB was
successfuly checkpointed and restored to completion. It both ran for the
remainder of the indented duration and we checked buffer content was as
expected at the end.

There is definitely more to do. Play more with exported buffers, syncobjs,
fences, buffer objects lists, but for now, as said, I am looking for some early
feedback etc.

v2:
 * Dropped the reserved VM ID query.
 * Made userptr address an explicit union in the bo list entry uapi.
 * Changed copy buffer from synchronous to providing a fence to userspace.
 * Rebased for removal of ctx->guilty.

v3:
 * Reworked for XArray context handling which landed in the meantime.
 * Implemented feedback from Christian:
   * Copy buffer:
     * Use syncobj timeline instead of sync_file.
     * Add offset and size support.
     * Use DMA_RESV_USAGE_BOOKKEEP.
   * Rework userptr detection and fetching of flags (new patches in series).

v4:
 * Catchup with upstream amdgpu changes.

Tvrtko Ursulin (7):
  drm/amdgpu: Check correct field in amdgpu_ttm_tt_is_userptr()
  drm/amdgpu: Move amdgpu_ttm_tt_is_userptr() under conditional
    compilation
  drm/amdgpu: Extend amdgpu_ttm_tt_get_userptr() to return flags
  drm/amdgpu: Extend listing of buffer handles with the userptr object
    flag
  drm/amdgpu: Add a new ioctl for listing client contexts
  drm/amdgpu: Add context handle renaming operation
  drm/amdgpu: Add driver managed buffer copy

 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c  | 143 ++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  |   4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c  | 146 ++++++++++++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h  |   4 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c  |  46 +++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h  |  16 ++-
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c |   4 +-
 include/uapi/drm/amdgpu_drm.h            |  59 ++++++++-
 8 files changed, 386 insertions(+), 36 deletions(-)

-- 
2.56.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-10-20 10:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 13:01 [PATCH v4 0/7] Tiny steps towards amdgpu checkpoint and restore Tvrtko Ursulin
2026-10-19 13:01 ` [PATCH v4 1/7] drm/amdgpu: Check correct field in amdgpu_ttm_tt_is_userptr() Tvrtko Ursulin
2026-10-20 10:55   ` Christian König
2026-10-19 13:01 ` [PATCH v4 2/7] drm/amdgpu: Move amdgpu_ttm_tt_is_userptr() under conditional compilation Tvrtko Ursulin
2026-10-20 10:56   ` Christian König
2026-10-19 13:01 ` [PATCH v4 3/7] drm/amdgpu: Extend amdgpu_ttm_tt_get_userptr() to return flags Tvrtko Ursulin
2026-10-19 13:01 ` [PATCH v4 4/7] drm/amdgpu: Extend listing of buffer handles with the userptr object flag Tvrtko Ursulin
2026-10-19 13:01 ` [PATCH v4 5/7] drm/amdgpu: Add a new ioctl for listing client contexts Tvrtko Ursulin
2026-10-19 13:01 ` [PATCH v4 6/7] drm/amdgpu: Add context handle renaming operation Tvrtko Ursulin
2026-10-19 13:01 ` [PATCH v4 7/7] drm/amdgpu: Add driver managed buffer copy Tvrtko Ursulin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.