]> git.dujemihanovic.xyz Git - linux.git/commit
drm/xe: Implement VM snapshot support for BO's and userptr
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 21 Feb 2024 13:30:21 +0000 (14:30 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 21 Feb 2024 19:08:57 +0000 (20:08 +0100)
commit0eb2a18a8fad629da8595bfc253d63d6bec71495
treea55b05d047c4900979c740f2b8e4d3aafc9e1bfc
parent0cd99046ca0522d8d212eb9adb093063a5f333ae
drm/xe: Implement VM snapshot support for BO's and userptr

Since we cannot immediately capture the BO's and userptr, perform it in
2 stages. The immediate stage takes a reference to each BO and userptr,
while a delayed worker captures the contents and then frees the
reference.

This is required because in signaling context, no locks can be taken, no
memory can be allocated, and no waits on userspace can be performed.

With the delayed worker, all of this can be performed very easily,
without having to resort to hacks.

Changes since v1:
- Fix crash on NULL captured vm.
- Use ascii85_encode to capture BO contents and save some space.
- Add length to coredump output for each captured area.
Changes since v2:
- Dump each mapping on their own line, to simplify tooling.
- Fix null pointer deref in xe_vm_snapshot_free.
Changes since v3:
- Don't add uninitialized value to snap->ofs. (Souza)
- Use kernel types for u32 and u64.
- Move snap_mutex destruction to final vm destruction. (Souza)
Changes since v4:
- Remove extra memset. (Souza)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240221133024.898315-6-maarten.lankhorst@linux.intel.com
drivers/gpu/drm/xe/xe_devcoredump.c
drivers/gpu/drm/xe/xe_devcoredump_types.h
drivers/gpu/drm/xe/xe_vm.c
drivers/gpu/drm/xe/xe_vm.h