From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eunm3-00013G-0m for qemu-devel@nongnu.org; Sat, 10 Mar 2018 18:19:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eunlz-00087N-Ry for qemu-devel@nongnu.org; Sat, 10 Mar 2018 18:19:34 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55746 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eunlz-00087B-Nv for qemu-devel@nongnu.org; Sat, 10 Mar 2018 18:19:31 -0500 References: <20180309090006.10018-1-peterx@redhat.com> <20180309090006.10018-10-peterx@redhat.com> From: Eric Blake Message-ID: <8dc180a7-b60a-2124-b212-cb24991ff343@redhat.com> Date: Sat, 10 Mar 2018 17:19:15 -0600 MIME-Version: 1.0 In-Reply-To: <20180309090006.10018-10-peterx@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v8 09/23] monitor: allow using IO thread for parsing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu , qemu-devel@nongnu.org Cc: Stefan Hajnoczi , "Daniel P . Berrange" , Paolo Bonzini , Fam Zheng , Juan Quintela , mdroth@linux.vnet.ibm.com, Laurent Vivier , Markus Armbruster , marcandre.lureau@redhat.com, "Dr . David Alan Gilbert" On 03/09/2018 02:59 AM, Peter Xu wrote: > For each Monitor, add one field "use_io_thr" to show whether it will be > using the dedicated monitor IO thread to handle input/output. When set, > monitor IO parsing work will be offloaded to the dedicated monitor IO > thread, rather than the original main loop thread. > > This only works for QMP. HMP will always be run on the main loop > thread. > > Currently we're still keeping use_io_thr off always. Will turn it on > later at some point. > > One thing to mention is that we cannot set use_io_thr for every QMP > monitor. The problem is that MUXed typed chardevs may not work well > with it now. When MUX is used, frontend of chardev can be the monitor > plus something else. The only thing we know would be safe to be run > outside main thread so far is the monitor frontend. All the rest of the > frontends should still be run in main thread only. > > Signed-off-by: Peter Xu > --- > monitor.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 90 insertions(+), 8 deletions(-) > > @@ -210,6 +213,11 @@ struct Monitor { > QTAILQ_ENTRY(Monitor) entry; > }; > > +/* Let's add monitor global variables to this struct. */ > +static struct { > + IOThread *mon_iothread; > +} mon_global; Anonymous struct type, but not the first time someone has done this, so it's okay. Reviewed-by: Eric Blake -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org