[PATCH v3 1/2] drm/virtio: Freeze and restore hooks to support suspend and resume
Dmitry Osipenko
dmitry.osipenko at collabora.com
Wed Jul 9 11:21:11 UTC 2025
On 7/3/25 01:24, dongwon.kim at intel.com wrote:
> +static int virtgpu_freeze(struct virtio_device *vdev)
> +{
> + struct drm_device *dev = vdev->priv;
> + struct virtio_gpu_device *vgdev = dev->dev_private;
> + int error;
> +
> + error = drm_mode_config_helper_suspend(dev);
> + if (error) {
> + DRM_ERROR("suspend error %d\n", error);
> + return error;
> + }
> +
> + flush_work(&vgdev->obj_free_work);
> + flush_work(&vgdev->ctrlq.dequeue_work);
> + flush_work(&vgdev->cursorq.dequeue_work);
> + flush_work(&vgdev->config_changed_work);
> +
> + wait_event(vgdev->ctrlq.ack_queue,
> + vgdev->ctrlq.vq->num_free == vgdev->ctrlq.vq->num_max);
> +
> + wait_event(vgdev->cursorq.ack_queue,
> + vgdev->cursorq.vq->num_free == vgdev->cursorq.vq->num_max);
Should be more correct to first do a wait_event() and then flush_work()
to not race with the work completion.
--
Best regards,
Dmitry
More information about the dri-devel
mailing list