[RFC 22/26] plugins/amdgpu: Handle DRM render node mmaps
Tvrtko Ursulin <[email protected]> Fri, 20 Feb 2026 12:05:10 +0000
| Newsgroups | dev.linux.lists.criu |
|---|---|
| Message-ID | <[email protected]> |
Outside the KFD world the CPU virtual memory address of a mmapp-ed buffer object is not guaranteed to be same as the GPU virtual address. Therefore the address check in VMA restore will prevent any restore of a render node process. For now we relax the criteria in case of render node to match only on the offset. In the future this will need to be made more robust so strange partial mmaps can be handled as well. Signed-off-by: Tvrtko Ursulin <[email protected]> --- plugins/amdgpu/amdgpu_plugin.c | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 693df0ea7e39..664536850c42 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -2170,25 +2170,28 @@ int amdgpu_plugin_update_vmamap(const char *in_path, const uint64_t addr, const } list_for_each_entry(vma_md, &update_vma_info_list, list) { - if (addr == vma_md->vma_entry && old_offset == vma_md->old_pgoff) { - *new_offset = vma_md->new_pgoff; + if (old_offset != vma_md->old_pgoff) + continue; + if (is_kfd && addr != vma_md->vma_entry) + continue; + *new_offset = vma_md->new_pgoff; + if (is_renderD) { + int fd = dup(vma_md->fd); + + if (fd == -1) { + pr_perror("unable to duplicate the render fd"); + return -1; + } + *updated_fd = fd; + } else { *updated_fd = -1; - if (is_renderD) { - int fd = dup(vma_md->fd); - if (fd == -1) { - pr_perror("unable to duplicate the render fd"); - return -1; - } - *updated_fd = fd; - } - - pr_debug("old_pgoff=0x%lx new_pgoff=0x%lx fd=%d\n", - vma_md->old_pgoff, vma_md->new_pgoff, - *updated_fd); - - return 1; } + + pr_debug("old_pgoff=0x%lx new_pgoff=0x%lx fd=%d\n", + vma_md->old_pgoff, vma_md->new_pgoff, *updated_fd); + + return 1; } pr_info("No match for addr:0x%lx offset:%lx\n", addr, old_offset); return 0; -- 2.52.0