libhsakmt: handle GPU mapping errors

Don't update the vm_object if GPU mapping failed. Print an error message
to help diagnose underlying problems.

Change-Id: I801ab6fe6c155bd25e6c0358007c106a4a019480
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
This commit is contained in:
Felix Kuehling
2020-10-21 13:23:51 -04:00
parent 8f26c0c40c
commit c7e6f5a274
+6
View File
@@ -2583,6 +2583,11 @@ static int _fmm_map_to_gpu(manageable_aperture_t *aperture,
args.n_success = 0;
ret = kmtIoctl(kfd_fd, AMDKFD_IOC_MAP_MEMORY_TO_GPU, &args);
if (ret) {
pr_err("GPU mapping failed (%d) for obj at %p, userptr %p, size %lu",
ret, object->start, object->userptr, object->size);
goto err_map_failed;
}
add_device_ids_to_mapped_array(object,
(uint32_t *)args.device_ids_array_ptr,
@@ -2601,6 +2606,7 @@ static int _fmm_map_to_gpu(manageable_aperture_t *aperture,
exit_ok:
err_object_not_found:
err_map_failed:
if (!obj)
pthread_mutex_unlock(&aperture->fmm_mutex);