contrib/vhost-user-gpu: the new GPU socket is refused after a device stop (VM pause or guest reset); the display stops and a later start aborts

Environment: as in #4848.

Steps: any of: stop and cont the VM (qm suspend / qm resume); reboot the guest from inside; unbind and bind virtio_gpu in the guest.

Result:

vg_process_msg: assertion 'g->sock_fd == -1' failed
(../contrib/vhost-user-gpu/vhost-user-gpu.c:177):vg_sock_fd_write: runtime check failed: (ret == buflen)
... at the next stop and start:
vhost-user-gpu: ../contrib/vhost-user-gpu/vhost-user-gpu.c:1117: set_gpu_protocol_features: Assertion `g->wait_in == 0' failed.

After a guest reset the guest waits 5 s for its display info and comes up without an EDID; nothing more is shown. The next stop and start aborts the process. Reproduced each of the three ways on an AMD host, also without any display client.

Analysis: vhost_user_gpu_set_status() closes the frontend's end of the GPU socket on every stop and sends VHOST_USER_GPU_SET_SOCKET with a new one on start. The backend takes a socket only while sock_fd == -1, and closes the old one only after a failed read or write (vg_sock_fd_close()); vg_queue_set_started(false) does not reset it. So the new socket is refused and the backend writes into the dead one. A request that waits for a reply (GET_DISPLAY_INFO, GET_EDID, DMABUF_UPDATE) then leaves wait_in set on g_unix_fd_add(-1, ...): the control queue stays blocked, and the next SET_SOCKET trips the wait_in assertion.

Expected: on a new SET_SOCKET, or when the device stops, the backend drops the old socket and any pending wait, and serves the new socket.

Signed-off-by: Dmitry R rdmitry0911@gmail.com