[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Test-qga:Qga write is blocked when the client is no connected, virtio-se
From: |
overgo |
Subject: |
Test-qga:Qga write is blocked when the client is no connected, virtio-serial port is throttled. |
Date: |
Wed, 26 Apr 2023 16:51:50 +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 migrated in 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.
- Test-qga:Qga write is blocked when the client is no connected, virtio-serial port is throttled.,
overgo <=