[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] input-linux: Reset il->fd handler before closing it
From: |
Li Qiang |
Subject: |
Re: [PATCH] input-linux: Reset il->fd handler before closing it |
Date: |
Fri, 25 Sep 2020 12:31:03 +0800 |
Colin Xu <colin.xu@intel.com> 于2020年9月25日周五 上午10:18写道:
>
> 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>
> ---
> ui/input-linux.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/ui/input-linux.c b/ui/input-linux.c
> index ab351a418701..34cc531190f9 100644
> --- a/ui/input-linux.c
> +++ b/ui/input-linux.c
> @@ -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);
> --
> 2.28.0
>
>