[Qemu-devel] [RFC v4 23/27] monitor: enable IO thread for (qmp & !mux) typed

Peter Xu posted 27 patches 8 years, 2 months ago
There is a newer version of this series
[Qemu-devel] [RFC v4 23/27] 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.

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 b18d9d696c..5e0b8ed9c5 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"
@@ -4456,7 +4457,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.6


Re: [Qemu-devel] [RFC v4 23/27] monitor: enable IO thread for (qmp & !mux) typed
Posted by Dr. David Alan Gilbert 8 years, 2 months ago
* Peter Xu (peterx@redhat.com) wrote:
> Start to use dedicate IO thread for QMP monitors that are not using
> MUXed chardev.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

I guess another way to do this would be to have a property on the
Chardev something like 'can use iothread' and clear that for Mux.

Dave

> ---
>  monitor.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor.c b/monitor.c
> index b18d9d696c..5e0b8ed9c5 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"
> @@ -4456,7 +4457,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.6
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

Re: [Qemu-devel] [RFC v4 23/27] monitor: enable IO thread for (qmp & !mux) typed
Posted by Peter Xu 8 years, 2 months ago
On Fri, Nov 24, 2017 at 11:01:49AM +0000, Dr. David Alan Gilbert wrote:
> * Peter Xu (peterx@redhat.com) wrote:
> > Start to use dedicate IO thread for QMP monitors that are not using
> > MUXed chardev.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> 
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Thanks!

> 
> I guess another way to do this would be to have a property on the
> Chardev something like 'can use iothread' and clear that for Mux.

Yeh we can.  Though I would still prefer to put that in Monitor struct
since current IOThread is really tailored only for monitors.  IOW not
all Chardevs can be run in the IOThread (or say, the thread currently
named as "mon_iothread") safely.  Thanks,

-- 
Peter Xu