Re: [PATCH] drm/virtio: fail init on display-info timeout

From: Dmitry Osipenko

Date: Tue Jun 30 2026 - 10:47:14 EST


On 6/30/26 16:36, Dmitry Osipenko wrote:
> On 6/25/26 06:02, Pengpeng Hou wrote:
>> virtio_gpu_init() sends GET_DISPLAY_INFO when scanouts are present and
>> waits for display_info_pending to clear. If the response never arrives,
>> the wait result is ignored and probe still succeeds.
>>
>> Return -ETIMEDOUT on display-info timeout. Because this happens after
>> virtio_device_ready(), reset the device and tear down modesetting before
>> using the existing vbuf and virtqueue cleanup path.
>>
>> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
>> ---
>> drivers/gpu/drm/virtio/virtgpu_kms.c | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c b/drivers/gpu/drm/virtio/virtgpu_kms.c
>> index cfde9f573df6..31209bea97ae 100644
>> --- a/drivers/gpu/drm/virtio/virtgpu_kms.c
>> +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
>> @@ -262,11 +262,19 @@ int virtio_gpu_init(struct virtio_device *vdev, struct drm_device *dev)
>> virtio_gpu_cmd_get_edids(vgdev);
>> virtio_gpu_cmd_get_display_info(vgdev);
>> virtio_gpu_notify(vgdev);
>> - wait_event_timeout(vgdev->resp_wq, !vgdev->display_info_pending,
>> - 5 * HZ);
>> + if (!wait_event_timeout(vgdev->resp_wq,
>> + !vgdev->display_info_pending,
>> + 5 * HZ)) {
>> + DRM_ERROR("timed out waiting for display info\n");
>> + ret = -ETIMEDOUT;
>> + goto err_ready;
>> + }
>> }
>> return 0;
>>
>> +err_ready:
>> + virtio_reset_device(vgdev->vdev);
>> + virtio_gpu_modeset_fini(vgdev);
>> err_scanouts:
>> virtio_gpu_free_vbufs(vgdev);
>> err_vbufs:
>
> Rebased and applied to misc-next, thanks!

Now see [1] having valid point on a leaked memory allocations. It's not
trivial to free that memory properly. Perhaps best will be to revert
this change and use wait_event() without timeout, will think further on
it before proceeding.

[1]
https://sashiko.dev/#/patchset/20260625030202.82590-1-pengpeng%40iscas.ac.cn

--
Best regards,
Dmitry