From patchwork Thu Aug 17 11:23:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guoyi Tu X-Patchwork-Id: 1822290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RRND50VVKz1yfk for ; Thu, 17 Aug 2023 21:33:09 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbEb-0001jy-BF; Thu, 17 Aug 2023 07:32:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbEX-0001iS-5A for qemu-devel@nongnu.org; Thu, 17 Aug 2023 07:32:09 -0400 Received: from smtpnm6-02.21cn.com ([182.42.154.78] helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbEU-0004v3-8l for qemu-devel@nongnu.org; Thu, 17 Aug 2023 07:32:08 -0400 HMM_SOURCE_IP: 192.168.139.44:35588.1307217768 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.64.85 (unknown [192.168.139.44]) by chinatelecom.cn (HERMES) with SMTP id 3E2061200C268; Thu, 17 Aug 2023 19:24:03 +0800 (CST) X-189-SAVE-TO-SEND: +tugy@chinatelecom.cn Received: from ([36.111.64.85]) by gateway-ssl-dep-56d86dc765-g96c8 with ESMTP id bf5ded637fe5494f94781e0db4b5782b for kraxel@redhat.com; Thu, 17 Aug 2023 19:24:05 CST X-Transaction-ID: bf5ded637fe5494f94781e0db4b5782b X-Real-From: tugy@chinatelecom.cn X-Receive-IP: 36.111.64.85 X-MEDUSA-Status: 0 From: tugy@chinatelecom.cn To: kraxel@redhat.com, marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, tugy@chinatelecom.cn, dengpc12@chinatelecom.cn Subject: [PATCH 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost Date: Thu, 17 Aug 2023 19:23:55 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=182.42.154.78; envelope-from=tugy@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Guoyi Tu when the agent connection is lost, the input handler of the mouse doesn't deactivate, which results in unresponsive mouse events in VNC windows. To fix this issue, call vdagent_disconnect() to reset the state each time the frontend disconncect Signed-off-by: Guoyi Tu Signed-off-by: dengpengcheng --- ui/vdagent.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/vdagent.c b/ui/vdagent.c index 8a651492f0..386dc5abe0 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -870,8 +870,11 @@ static void vdagent_disconnect(VDAgentChardev *vd) static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open) { + VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(chr); + if (!fe_open) { trace_vdagent_close(); + vdagent_disconnect(vd); /* To reset_serial, we CLOSED our side. Make sure the other end knows we * are ready again. */ qemu_chr_be_event(chr, CHR_EVENT_OPENED); @@ -922,7 +925,6 @@ static void vdagent_chr_fini(Object *obj) VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(obj); migrate_del_blocker(vd->migration_blocker); - vdagent_disconnect(vd); buffer_free(&vd->outbuf); error_free(vd->migration_blocker); } From patchwork Thu Aug 17 11:23:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guoyi Tu X-Patchwork-Id: 1822289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RRNCq15S5z1yfk for ; Thu, 17 Aug 2023 21:32:55 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbEa-0001jU-MM; Thu, 17 Aug 2023 07:32:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbEY-0001jB-Un for qemu-devel@nongnu.org; Thu, 17 Aug 2023 07:32:10 -0400 Received: from smtpnm6-02.21cn.com ([182.42.154.78] helo=chinatelecom.cn) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbEU-0004v7-Ri for qemu-devel@nongnu.org; Thu, 17 Aug 2023 07:32:10 -0400 HMM_SOURCE_IP: 192.168.139.44:35588.1307217768 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-36.111.64.85 (unknown [192.168.139.44]) by chinatelecom.cn (HERMES) with SMTP id A95B51237AAD0; Thu, 17 Aug 2023 19:24:06 +0800 (CST) X-189-SAVE-TO-SEND: +tugy@chinatelecom.cn Received: from ([36.111.64.85]) by gateway-ssl-dep-56d86dc765-g96c8 with ESMTP id d2e754c77194406099d22ac2c52969a6 for kraxel@redhat.com; Thu, 17 Aug 2023 19:24:07 CST X-Transaction-ID: d2e754c77194406099d22ac2c52969a6 X-Real-From: tugy@chinatelecom.cn X-Receive-IP: 36.111.64.85 X-MEDUSA-Status: 0 From: tugy@chinatelecom.cn To: kraxel@redhat.com, marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, tugy@chinatelecom.cn, dengpc12@chinatelecom.cn Subject: [PATCH 2/2] ui/vdagent: Unregister input handler of mouse during finalization Date: Thu, 17 Aug 2023 19:23:56 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=182.42.154.78; envelope-from=tugy@chinatelecom.cn; helo=chinatelecom.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Guoyi Tu Input handler resource should be released when VDAgentChardev object finalize Signed-off-by: Guoyi Tu Signed-off-by: dengpengcheng Reviewed-by: Marc-André Lureau --- ui/vdagent.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/vdagent.c b/ui/vdagent.c index 386dc5abe0..4c9b3b7ba8 100644 --- a/ui/vdagent.c +++ b/ui/vdagent.c @@ -924,6 +924,9 @@ static void vdagent_chr_fini(Object *obj) { VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(obj); + if (vd->mouse_hs) { + qemu_input_handler_unregister(vd->mouse_hs); + } migrate_del_blocker(vd->migration_blocker); buffer_free(&vd->outbuf); error_free(vd->migration_blocker);