[Qemu-devel] [PATCH v2] monitor: accept input on resume

Marc-André Lureau posted 1 patch 7 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180817173752.19136-1-marcandre.lureau@redhat.com
Test checkpatch passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
monitor.c | 1 +
1 file changed, 1 insertion(+)
[Qemu-devel] [PATCH v2] monitor: accept input on resume
Posted by Marc-André Lureau 7 years, 2 months ago
A chardev may stop trying to write if the associated can_read()
callback returned 0. This happens when the monitor is suspended.
The frontend is supposed to call qemu_chr_fe_accept_input() when it is
ready to accept data again.

An issue was observed with a spice port: pending commands may be
delayed, as the chardev is not flushed. Most chardev don't use the
accept_input() callback, and instead check regularly if they can
write. The ones that do use it are braille, mux, msmouse,
spice (abstract), spicevmc, spiceport, wctablet.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/monitor.c b/monitor.c
index a1999e396c..33823b035a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4407,6 +4407,7 @@ void monitor_resume(Monitor *mon)
             assert(mon->rs);
             readline_show_prompt(mon->rs);
         }
+        qemu_chr_fe_accept_input(&mon->chr);
     }
     trace_monitor_suspend(mon, -1);
 }
-- 
2.18.0.547.g1d89318c48


Re: [Qemu-devel] [PATCH v2] monitor: accept input on resume
Posted by Markus Armbruster 7 years, 2 months ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> A chardev may stop trying to write if the associated can_read()
> callback returned 0. This happens when the monitor is suspended.
> The frontend is supposed to call qemu_chr_fe_accept_input() when it is
> ready to accept data again.
>
> An issue was observed with a spice port: pending commands may be
> delayed, as the chardev is not flushed. Most chardev don't use the
> accept_input() callback, and instead check regularly if they can
> write. The ones that do use it are braille, mux, msmouse,
> spice (abstract), spicevmc, spiceport, wctablet.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Acked-by: Markus Armbruster <armbru@redhat.com>
> ---
>  monitor.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/monitor.c b/monitor.c
> index a1999e396c..33823b035a 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -4407,6 +4407,7 @@ void monitor_resume(Monitor *mon)
>              assert(mon->rs);
>              readline_show_prompt(mon->rs);
>          }
> +        qemu_chr_fe_accept_input(&mon->chr);
>      }
>      trace_monitor_suspend(mon, -1);
>  }

Queued.  Thanks!