OSDN Git Service

input-linux: Reset il->fd handler before closing it
authorColin Xu <colin.xu@intel.com>
Fri, 25 Sep 2020 02:18:08 +0000 (10:18 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 14 Oct 2020 04:05:56 +0000 (06:05 +0200)
If object-del input-linux object on-the-fly, instance finalize will
close evdev fd without resetting it. However the main thread is still
trying to lock_acquire/lock_release during ppoll, which leads to a very
high CPU utilization.

Signed-off-by: Colin Xu <colin.xu@intel.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-id: 20200925021808.26471-1-colin.xu@intel.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/input-linux.c

index ab351a4..34cc531 100644 (file)
@@ -418,6 +418,7 @@ static void input_linux_instance_finalize(Object *obj)
 
     if (il->initialized) {
         QTAILQ_REMOVE(&inputs, il, next);
+        qemu_set_fd_handler(il->fd, NULL, NULL, NULL);
         close(il->fd);
     }
     g_free(il->evdev);