qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* patch:avoid-to-create-a-null-watch-in-flush_buf
@ 2023-04-26  7:17 wangc66
  0 siblings, 0 replies; only message in thread
From: wangc66 @ 2023-04-26  7:17 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 43193 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-26  7:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26  7:17 patch:avoid-to-create-a-null-watch-in-flush_buf wangc66

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).