[Qemu-devel] [RFC v2 16/22] monitor: enable IO thread for (qmp & !mux) typed

Peter Xu posted 22 patches 8 years, 2 months ago
There is a newer version of this series
[Qemu-devel] [RFC v2 16/22] monitor: enable IO thread for (qmp & !mux) typed
Posted by Peter Xu 8 years, 2 months ago
Start to use dedicate IO thread for QMP monitors that are not using
MUXed chardev.

We excluded MUXed chardev because when mux is used, frontend can be the
monitor plus something else.  The only thing we know would be safe to be
run outside main thread is the monitor frontend, all the rest of the
frontends should still be run in main thread only.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 monitor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/monitor.c b/monitor.c
index d9bed31248..847468ecb0 100644
--- a/monitor.c
+++ b/monitor.c
@@ -36,6 +36,7 @@
 #include "net/net.h"
 #include "net/slirp.h"
 #include "chardev/char-fe.h"
+#include "chardev/char-mux.h"
 #include "ui/qemu-spice.h"
 #include "sysemu/numa.h"
 #include "monitor/monitor.h"
@@ -4262,7 +4263,7 @@ void monitor_init(Chardev *chr, int flags)
     Monitor *mon = g_malloc(sizeof(*mon));
     GMainContext *context;
 
-    monitor_data_init(mon, false, false);
+    monitor_data_init(mon, false, !CHARDEV_IS_MUX(chr));
 
     qemu_chr_fe_init(&mon->chr, chr, &error_abort);
     mon->flags = flags;
-- 
2.13.5


Re: [Qemu-devel] [RFC v2 16/22] monitor: enable IO thread for (qmp & !mux) typed
Posted by Stefan Hajnoczi 8 years, 2 months ago
On Fri, Sep 29, 2017 at 11:38:38AM +0800, Peter Xu wrote:
> Start to use dedicate IO thread for QMP monitors that are not using
> MUXed chardev.
> 
> We excluded MUXed chardev because when mux is used, frontend can be the
> monitor plus something else.  The only thing we know would be safe to be
> run outside main thread is the monitor frontend, all the rest of the
> frontends should still be run in main thread only.

Please move this explanation into a comment so it's immediately visible
when reading the code.

Re: [Qemu-devel] [RFC v2 16/22] monitor: enable IO thread for (qmp & !mux) typed
Posted by Peter Xu 8 years, 2 months ago
On Thu, Oct 12, 2017 at 01:57:55PM +0100, Stefan Hajnoczi wrote:
> On Fri, Sep 29, 2017 at 11:38:38AM +0800, Peter Xu wrote:
> > Start to use dedicate IO thread for QMP monitors that are not using
> > MUXed chardev.
> > 
> > We excluded MUXed chardev because when mux is used, frontend can be the
> > monitor plus something else.  The only thing we know would be safe to be
> > run outside main thread is the monitor frontend, all the rest of the
> > frontends should still be run in main thread only.
> 
> Please move this explanation into a comment so it's immediately visible
> when reading the code.

Will do. Thanks,

-- 
Peter Xu