Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/virtio: resource loss on resume for userptr blobs --
commit 260e023045965d09441bfc27b3e47cf7b409d5b4 Author: Honglei Huang <[email protected]> drm/virtio: wire blob ioctl creation to userptr objects This commit integrates userptr into the blob resource creation ioctl. It adds validation and wires up virtio_gpu_userptr_create() for guest blob allocations. > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c [ ... ] > @@ -538,7 +561,9 @@ static int virtio_gpu_resource_create_blob_ioctl(struct > drm_device *dev, > vfpriv->ctx_id, NULL, NULL); > } > > - if (guest_blob) > + if (guest_blob && params.userptr) > + ret = virtio_gpu_userptr_create(vgdev, file, ¶ms, &bo); [Severity: High] Does this code handle system hibernation properly for userptr objects? When virtio_gpu_userptr_create() in drivers/gpu/drm/virtio/virtgpu_userptr.c successfully allocates the object, it returns without saving bo->params or calling virtio_gpu_add_object_to_restore_list(): virtio_gpu_cmd_resource_create_blob(vgdev, &userptr->base, params, ents, nents); *bo_ptr = &userptr->base; return 0; Consequently, these objects are permanently lost when the system resumes from hibernation because their host-side resources are not re-created. Subsequent GPU commands referencing these resources will fail. Additionally, if these userptr objects were added to the obj_restore_list, it seems virtio_gpu_object_restore_all() in drivers/gpu/drm/virtio/virtgpu_object.c would crash: if (bo->params.blob || bo->attached) { ret = virtio_gpu_object_shmem_init(vgdev, bo, &ents, &nents); if (ret) break; } This logic assumes all non-imported blobs are backed by drm_gem_shmem_object, but userptr blobs are not. > + else if (guest_blob) > ret = virtio_gpu_object_create(vgdev, ¶ms, &bo, NULL); > else if (!guest_blob && host3d_blob) > ret = virtio_gpu_vram_create(vgdev, ¶ms, &bo); -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=4
