qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling
@ 2023-08-17 14:12 tugy
  2023-08-17 14:12 ` [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost tugy
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: tugy @ 2023-08-17 14:12 UTC (permalink / raw)
  To: kraxel, marcandre.lureau; +Cc: qemu-devel, tugy, dengpc12

From: Guoyi Tu <tugy@chinatelecom.cn>

and resource leak

Guoyi Tu (2):
  ui/vdagent: call vdagent_disconnect() when agent connection is lost
  ui/vdagent: Unregister input handler of mouse during finalization

 ui/vdagent.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.27.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost
  2023-08-17 14:12 [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling tugy
@ 2023-08-17 14:12 ` tugy
  2023-08-17 14:26   ` Marc-André Lureau
  2023-08-17 14:12 ` [PATCH v1 2/2] ui/vdagent: Unregister input handler of mouse during finalization tugy
  2023-09-04 11:25 ` [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling Guoyi Tu
  2 siblings, 1 reply; 8+ messages in thread
From: tugy @ 2023-08-17 14:12 UTC (permalink / raw)
  To: kraxel, marcandre.lureau; +Cc: qemu-devel, tugy, dengpc12

From: Guoyi Tu <tugy@chinatelecom.cn>

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 <tugy@chinatelecom.cn>
Signed-off-by: dengpengcheng <dengpc12@chinatelecom.cn>
---
 ui/vdagent.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/vdagent.c b/ui/vdagent.c
index 8a651492f0..4b9a1fb7c5 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);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v1 2/2] ui/vdagent: Unregister input handler of mouse during finalization
  2023-08-17 14:12 [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling tugy
  2023-08-17 14:12 ` [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost tugy
@ 2023-08-17 14:12 ` tugy
  2023-08-17 14:26   ` Marc-André Lureau
  2023-09-04 11:25 ` [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling Guoyi Tu
  2 siblings, 1 reply; 8+ messages in thread
From: tugy @ 2023-08-17 14:12 UTC (permalink / raw)
  To: kraxel, marcandre.lureau; +Cc: qemu-devel, tugy, dengpc12

From: Guoyi Tu <tugy@chinatelecom.cn>

Input handler resource should be released when
VDAgentChardev object finalize

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Signed-off-by: dengpengcheng <dengpc12@chinatelecom.cn>
---
 ui/vdagent.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/vdagent.c b/ui/vdagent.c
index 4b9a1fb7c5..00d36a8677 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -926,6 +926,9 @@ static void vdagent_chr_fini(Object *obj)
 
     migrate_del_blocker(vd->migration_blocker);
     vdagent_disconnect(vd);
+    if (vd->mouse_hs) {
+        qemu_input_handler_unregister(vd->mouse_hs);
+    }
     buffer_free(&vd->outbuf);
     error_free(vd->migration_blocker);
 }
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost
  2023-08-17 14:12 ` [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost tugy
@ 2023-08-17 14:26   ` Marc-André Lureau
  0 siblings, 0 replies; 8+ messages in thread
From: Marc-André Lureau @ 2023-08-17 14:26 UTC (permalink / raw)
  To: tugy; +Cc: kraxel, qemu-devel, dengpc12

On Thu, Aug 17, 2023 at 6:24 PM <tugy@chinatelecom.cn> wrote:
>
> From: Guoyi Tu <tugy@chinatelecom.cn>
>
> 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 <tugy@chinatelecom.cn>
> Signed-off-by: dengpengcheng <dengpc12@chinatelecom.cn>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  ui/vdagent.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/ui/vdagent.c b/ui/vdagent.c
> index 8a651492f0..4b9a1fb7c5 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);
> --
> 2.27.0
>
>


-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 2/2] ui/vdagent: Unregister input handler of mouse during finalization
  2023-08-17 14:12 ` [PATCH v1 2/2] ui/vdagent: Unregister input handler of mouse during finalization tugy
@ 2023-08-17 14:26   ` Marc-André Lureau
  0 siblings, 0 replies; 8+ messages in thread
From: Marc-André Lureau @ 2023-08-17 14:26 UTC (permalink / raw)
  To: tugy; +Cc: kraxel, qemu-devel, dengpc12

On Thu, Aug 17, 2023 at 6:24 PM <tugy@chinatelecom.cn> wrote:
>
> From: Guoyi Tu <tugy@chinatelecom.cn>
>
> Input handler resource should be released when
> VDAgentChardev object finalize
>
> Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
> Signed-off-by: dengpengcheng <dengpc12@chinatelecom.cn>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  ui/vdagent.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/ui/vdagent.c b/ui/vdagent.c
> index 4b9a1fb7c5..00d36a8677 100644
> --- a/ui/vdagent.c
> +++ b/ui/vdagent.c
> @@ -926,6 +926,9 @@ static void vdagent_chr_fini(Object *obj)
>
>      migrate_del_blocker(vd->migration_blocker);
>      vdagent_disconnect(vd);
> +    if (vd->mouse_hs) {
> +        qemu_input_handler_unregister(vd->mouse_hs);
> +    }
>      buffer_free(&vd->outbuf);
>      error_free(vd->migration_blocker);
>  }
> --
> 2.27.0
>
>


-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling
  2023-08-17 14:12 [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling tugy
  2023-08-17 14:12 ` [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost tugy
  2023-08-17 14:12 ` [PATCH v1 2/2] ui/vdagent: Unregister input handler of mouse during finalization tugy
@ 2023-09-04 11:25 ` Guoyi Tu
  2023-09-04 11:28   ` Marc-André Lureau
  2 siblings, 1 reply; 8+ messages in thread
From: Guoyi Tu @ 2023-09-04 11:25 UTC (permalink / raw)
  To: kraxel, marcandre.lureau; +Cc: tugy, qemu-devel, dengpc12

Hi Gerd, what do you think of these two patches? Can they be merged into
the upstream?

On 2023/8/17 22:12, tugy@chinatelecom.cn wrote:
> From: Guoyi Tu <tugy@chinatelecom.cn>
> 
> and resource leak
> 
> Guoyi Tu (2):
>    ui/vdagent: call vdagent_disconnect() when agent connection is lost
>    ui/vdagent: Unregister input handler of mouse during finalization
> 
>   ui/vdagent.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling
  2023-09-04 11:25 ` [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling Guoyi Tu
@ 2023-09-04 11:28   ` Marc-André Lureau
  2023-09-04 11:36     ` Guoyi Tu
  0 siblings, 1 reply; 8+ messages in thread
From: Marc-André Lureau @ 2023-09-04 11:28 UTC (permalink / raw)
  To: Guoyi Tu; +Cc: kraxel, qemu-devel, dengpc12

Hi

On Mon, Sep 4, 2023 at 3:26 PM Guoyi Tu <tugy@chinatelecom.cn> wrote:
>
> Hi Gerd, what do you think of these two patches? Can they be merged into
> the upstream?

I'll queue them.

thanks



-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling
  2023-09-04 11:28   ` Marc-André Lureau
@ 2023-09-04 11:36     ` Guoyi Tu
  0 siblings, 0 replies; 8+ messages in thread
From: Guoyi Tu @ 2023-09-04 11:36 UTC (permalink / raw)
  To: 【外部账号】Marc-André Lureau
  Cc: tugy, kraxel, qemu-devel, dengpc12

On 2023/9/4 19:28, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Sep 4, 2023 at 3:26 PM Guoyi Tu <tugy@chinatelecom.cn> wrote:
>>
>> Hi Gerd, what do you think of these two patches? Can they be merged into
>> the upstream?
> 
> I'll queue them.
> 
> thanks
> 
> 
> 
I'm glad they can be merged. Thank you.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-04 11:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-17 14:12 [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling tugy
2023-08-17 14:12 ` [PATCH v1 1/2] ui/vdagent: call vdagent_disconnect() when agent connection is lost tugy
2023-08-17 14:26   ` Marc-André Lureau
2023-08-17 14:12 ` [PATCH v1 2/2] ui/vdagent: Unregister input handler of mouse during finalization tugy
2023-08-17 14:26   ` Marc-André Lureau
2023-09-04 11:25 ` [PATCH v1 0/2] ui/vdagent: Fix two bugs about disconnect event handling Guoyi Tu
2023-09-04 11:28   ` Marc-André Lureau
2023-09-04 11:36     ` Guoyi Tu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).