From: "wangc66@chinatelecom.cn" <wangc66@chinatelecom.cn>
To: qemu-devel <qemu-devel@nongnu.org>
Subject: patch:avoid-to-create-a-null-watch-in-flush_buf
Date: Wed, 26 Apr 2023 15:17:17 +0800 [thread overview]
Message-ID: <2023042615171480918124@chinatelecom.cn> (raw)
[-- 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 --]
reply other threads:[~2023-04-26 7:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023042615171480918124@chinatelecom.cn \
--to=wangc66@chinatelecom.cn \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).