Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] drm/virtio: suspend/resume broken for userptr blobs due to missing 
restore_list insertion
--

commit fa2044a8302d0462020754a25069b6a6d031a3a7
Author: Honglei Huang <[email protected]>

drm/virtio: implement userptr support for zero-copy memory access

This commit adds support for userptr blob objects in the virtio-gpu driver.
It allows the guest kernel to pin existing userspace mappings and advertise
them to the host as CREATE_BLOB backing entries.

> diff --git a/drivers/gpu/drm/virtio/virtgpu_userptr.c 
> b/drivers/gpu/drm/virtio/virtgpu_userptr.c
> new file mode 100644
> index 0000000000000..2f86a95ad2e65
> --- /dev/null
> +++ b/drivers/gpu/drm/virtio/virtgpu_userptr.c

[ ... ]

> +int virtio_gpu_userptr_create(struct virtio_gpu_device *vgdev,
> +                           struct drm_file *file,
> +                           struct virtio_gpu_object_params *params,
> +                           struct virtio_gpu_object **bo_ptr)
> +{

[ ... ]

> +     ret = virtio_gpu_userptr_get_entries(vgdev, userptr, &ents, &nents);
> +     if (ret)
> +             goto err_cleanup;
> +
> +     virtio_gpu_cmd_resource_create_blob(vgdev, &userptr->base, params, ents,
> +                                         nents);
> +
> +     *bo_ptr = &userptr->base;
> +     return 0;

[Severity: High]
Does this code miss saving the creation parameters and adding the object to 
the restore list?

If the guest suspends and resumes, virtio_gpu_object_restore_all() needs to 
recreate resources on the host. Without saving params into the base object 
(e.g., bo->params = *params) and calling 
virtio_gpu_add_object_to_restore_list(), this userptr object might be skipped 
during system resume. 

This causes subsequent command submissions using this resource ID to be 
rejected by the host when the guest userspace resumes and tries to access 
the resource.

> +
> +err_cleanup:
> +     virtio_gpu_cleanup_object(&userptr->base);
> +     return ret;
> +}

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to