qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch:avoid-to-create-a-null-watch-in-flush_buf


From: address@hidden
Subject: patch:avoid-to-create-a-null-watch-in-flush_buf
Date: Wed, 26 Apr 2023 15:17:17 +0800

Hi, I am testing when qga push msg to libvirt, when the vm saved and restore from the memory file, the qga will be hunged in writing.

In flush_buf:
(gdb) f 4
#4  0x000055ffc716894a in flush_buf (port=0x55ffc87bf800, buf=<optimized out>, len=<optimized out>) at ../hw/char/virtio-console.c:100
100                     vcon->watch = qemu_chr_fe_add_watch(&vcon->chr,
(gdb) l
95               * use throttling on host side.
96               */
97              if (!k->is_console) {
98                  virtio_serial_throttle_port(port, true);
99                  if (!vcon->watch) {
100                     vcon->watch = qemu_chr_fe_add_watch(&vcon->chr,
101                                                         G_IO_OUT|G_IO_HUP,
102                                                         chr_write_unblocked, vcon);
103                 }
104             }
vcon->watch is 0, but the port is throttled, so it will not process the fe event, until restart qga or restart libvirtd.
This issue is happend when the vm is migrating or restore from a memory file saved.
So I think it can be fixed by following:
100                     vcon->watch = qemu_chr_fe_add_watch(&vcon->chr,
(gdb) l
95               * use throttling on host side.
96               */
97              if (!k->is_console) {
98                  virtio_serial_throttle_port(port, true);
99                  if (!vcon->watch) {
100                     vcon->watch = qemu_chr_fe_add_watch(&vcon->chr,
101                                                         G_IO_OUT|G_IO_HUP,
102                                                         chr_write_unblocked, vcon);
+                       if (!vcon->watch)
+                            virtio_serial_throttle_port(port, false);
103                 }
104             }
I have test the code, and it works.


wangc66@chinatelecom.cn

reply via email to

[Prev in Thread] Current Thread [Next in Thread]