drm/amdkfd: skip GPUs without a VM when checkpointing the BO mappings
Subsystems (3)
PATCH 1/1 drm/amdkfd: skip GPUs without a VM when checkpointing the BO mappings
criu_checkpoint_bos() asks every device of the process whether a BO is mapped there, passing its drm_priv, which is NULL for the devices the process never acquired a VM on. On navi48 with its iGPU, checkpointing a process which acquired the VM of the dGPU only:
Oops: general protection fault, probably for non-canonical address 0xdffffc000000002f: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000178-0x000000000000017f] RIP: 0010:amdgpu_amdkfd_bo_mapped_to_dev+0x35/0x160 [amdgpu] kfd_ioctl_criu+0x30d1/0x4aa0 [amdgpu] kfd_ioctl+0x767/0xb10 [amdgpu]
Nothing can be mapped on such a device, skip it.
Fixes f9e292cbba21 ("drm/amdkfd: kfd_bo_mapped_dev support partition")
Signed-off-by Jesse Zhang <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +3 -1
@@ -2175,7 +2175,9 @@ static int criu_checkpoint_bos(struct kfd_process *p, bo_bucket->offset =amdgpu_bo_mmap_offset (dumper_bo);for (i =0 ; i < p->n_pdds; i++) { -if (amdgpu_amdkfd_bo_mapped_to_dev (p->pdds[i]->drm_priv, kgd_mem)) +/* nothing is mapped on a GPU without a VM */ +if (p->pdds[i]->drm_priv && +amdgpu_amdkfd_bo_mapped_to_dev (p->pdds[i]->drm_priv, kgd_mem)) bo_priv->mapped_gpuids[dev_idx++] = p->pdds[i]->user_gpu_id; }
Signature · 1 line
2.50.1
Quoted 11 lines · Jesse Zhang
criu_checkpoint_bos()asks every device of the process whether a BO is mapped there, passing itsdrm_priv, which is NULL for the devices the process never acquired a VM on. On navi48 with its iGPU, checkpointing a process which acquired the VM of the dGPU only:Oops: general protection fault, probably for non-canonical address 0xdffffc000000002f: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000178-0x000000000000017f] RIP: 0010:amdgpu_amdkfd_bo_mapped_to_dev+0x35/0x160 [amdgpu] kfd_ioctl_criu+0x30d1/0x4aa0 [amdgpu] kfd_ioctl+0x767/0xb10 [amdgpu]
Quoted 4 lines
Nothing can be mapped on such a device, skip it.
Fixes f9e292cbba21 ("drm/amdkfd: kfd_bo_mapped_dev support partition")Signed-off-by Jesse Zhang <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Quoted 19 lines
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +3
-1@@ -2175,7 +2175,9 @@ static int criu_checkpoint_bos(struct kfd_process *p, bo_bucket->offset =amdgpu_bo_mmap_offset (dumper_bo);for (i =0 ; i < p->n_pdds; i++) { -if (amdgpu_amdkfd_bo_mapped_to_dev (p->pdds[i]->drm_priv, kgd_mem)) +/* nothing is mapped on a GPU without a VM */ +if (p->pdds[i]->drm_priv && +amdgpu_amdkfd_bo_mapped_to_dev (p->pdds[i]->drm_priv, kgd_mem)) bo_priv->mapped_gpuids[dev_idx++] = p->pdds[i]->user_gpu_id; }