Skip to contentSkip to conversation

monitor: accept input on resume

PATCH Superseded Marc-André Lureau 3 participants 4 messages Jul 31, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 monitor: accept input on resume

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.

---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +1 -0
index d580c5a79c..e1a14e02cf 100644
@@ -4412,6 +4412,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);
 }
Signature · 1 line
2.18.0.321.gffc6fa0e39
#1 lore raw
Quoted 6 lines · Marc-André Lureau

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.

Impact?

Is this to be considered for 3.0?

Quoted 16 lines
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +1 -0
index d580c5a79c..e1a14e02cf 100644
@@ -4412,6 +4412,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 lore raw

Hi

Quoted 10 lines · Markus Armbruster
Quoted 6 lines · Marc-André Lureau

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.

Impact?

I have observed the issue with a spice port, all pending commands aren't flushed. Most chardev don't use the accept_input() callback, and instead poll regularly, like char-socket.c:tcp_chr_read_poll()

Quoted 2 lines

Is this to be considered for 3.0?

This is not a regression, afaik, and doesn't impact common monitor chardev. So it could be delayed. But it's also a small fix for Spice chardev that shouldn't create regression, so it should be fine for 3.0.

thanks

Quoted 18 lines
Quoted 17 lines
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)
monitor.c +1 -0
index d580c5a79c..e1a14e02cf 100644
@@ -4412,6 +4412,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);
 }
Signature · 1 line
Marc-André Lureau
#3 lore raw
Quoted 10 lines · Marc-André Lureau

Hi

Quoted 7 lines · Markus Armbruster
Quoted 5 lines · Marc-André Lureau

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.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Impact?

I have observed the issue with a spice port, all pending commands aren't flushed. Most chardev don't use the accept_input() callback, and instead poll regularly, like char-socket.c:tcp_chr_read_poll()

The ones that do use it are braille, mux, msmouse, spice (abstract), spicevmc, spiceport, wctablet.

A description of the impact should be worked into the commit message.

Quoted 6 lines
Quoted 1 line

Is this to be considered for 3.0?

This is not a regression, afaik, and doesn't impact common monitor chardev. So it could be delayed. But it's also a small fix for Spice chardev that shouldn't create regression, so it should be fine for 3.0.

If the callbacks we now call all work fine, we should be good. But that's a chardev question, and I'm the guy for the monitor questions. I think the decision needs to be made by maintainers of the chardev subsystem.

Preferably with an improved commit message: