A GL display client that stays attached across a device stop can unblock
the console after vhost_gpu_fd has been reset to -1: the UpdateDMABUF
reply or the one-second gl unblock timer reach
vhost_user_gpu_gl_flushed(), which installs the display socket handler
on fd -1. With the io_uring fd monitor, the failed poll of fd -1 is
reported as readiness, so the handler runs and is re-armed forever.
Only set the handler when the device has a display socket.
Fixes: 3cddb8b9e0b5 ("display/ui: add a callback to indicate GL state is
flushed")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4847
Reported-by: Dmitry R <[email protected]>
Tested-by: Dmitry R <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
---
hw/display/vhost-user-gpu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c
index 46e7fc136583..5874f3a50b28 100644
--- a/hw/display/vhost-user-gpu.c
+++ b/hw/display/vhost-user-gpu.c
@@ -449,6 +449,11 @@ end:
static void
vhost_user_gpu_update_blocked(VhostUserGPU *g, bool blocked)
{
+ /* the display socket doesn't exist before DRIVER_OK */
+ if (g->vhost_gpu_fd == -1) {
+ return;
+ }
+
qemu_set_fd_handler(g->vhost_gpu_fd,
blocked ? NULL : vhost_user_gpu_chr_read, NULL, g);
}
--
2.56.0.116.g6de20f6092dc