[{"id":1768679,"web_url":"http://patchwork.ozlabs.org/comment/1768679/","msgid":"<20170914153334.GC7370@stefanha-x1.localdomain>","list_archive_url":null,"date":"2017-09-14T15:33:34","subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","submitter":{"id":17227,"url":"http://patchwork.ozlabs.org/api/people/17227/","name":"Stefan Hajnoczi","email":"stefanha@redhat.com"},"content":"On Thu, Sep 14, 2017 at 03:50:35PM +0800, Peter Xu wrote:\n> diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\n> index 61fa167..47d16bb 100644\n> --- a/docs/devel/qapi-code-gen.txt\n> +++ b/docs/devel/qapi-code-gen.txt\n> @@ -665,6 +665,16 @@ allowed to run out-of-band can also be introspected using\n>  query-qmp-schema command.  Please see the section \"Client JSON\n>  Protocol introspection\" for more information.\n>  \n> +To execute a command in out-of-band way, we need to specify the\n> +\"control\" field in the request, with \"run-oob\" set to true. Example:\n> +\n> + => { \"execute\": \"command-support-oob\",\n> +      \"arguments\": { ... },\n> +      \"control\": { \"run-oob\": true } }\n> + <= { \"return\": { } }\n> +\n> +Without it, even the commands that supports out-of-band execution will\n> +still be run in-band.\n\nIs there a more relevant place to document QMP run-oob behavior than the\n\"How to use the QAPI code generator document\"?\n\n> @@ -3963,6 +3964,16 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens,\n>      req_obj->id = id;\n>      req_obj->req = req;\n>  \n> +    if (qmp_is_oob(req)) {\n> +        /*\n> +         * Trigger fast-path to handle the out-of-band request, by\n> +         * executing the command directly in parser.\n> +         */\n> +        trace_monitor_qmp_cmd_out_of_band(qobject_get_str(req_obj->id));\n> +        monitor_qmp_dispatch_one(req_obj);\n> +        return;\n> +    }\n\nA \"fast-path\" is a performance optimization.  OOB is not a performance\noptimization, it changes the semantics of command execution.  Please\nmention the semantics of OOB command execution instead.\n\nStefa","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=stefanha@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtMzj1fPnz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 01:35:12 +1000 (AEST)","from localhost ([::1]:48453 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsWAZ-0000ee-07\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 11:35:11 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:49009)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <stefanha@redhat.com>) id 1dsW94-0008Rr-Q3\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:33:44 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <stefanha@redhat.com>) id 1dsW93-0001Ft-QW\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:33:38 -0400","from mx1.redhat.com ([209.132.183.28]:40970)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <stefanha@redhat.com>) id 1dsW93-0001FF-KW\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 11:33:37 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id AEA6D883AC;\n\tThu, 14 Sep 2017 15:33:36 +0000 (UTC)","from localhost (ovpn-117-58.ams2.redhat.com [10.36.117.58])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id DD0315883F;\n\tThu, 14 Sep 2017 15:33:35 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com AEA6D883AC","Date":"Thu, 14 Sep 2017 16:33:34 +0100","From":"Stefan Hajnoczi <stefanha@redhat.com>","To":"Peter Xu <peterx@redhat.com>","Message-ID":"<20170914153334.GC7370@stefanha-x1.localdomain>","References":"<1505375436-28439-1-git-send-email-peterx@redhat.com>\n\t<1505375436-28439-15-git-send-email-peterx@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<1505375436-28439-15-git-send-email-peterx@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tThu, 14 Sep 2017 15:33:36 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tmdroth@linux.vnet.ibm.com, Juan Quintela <quintela@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org, Stefan\n\tHajnoczi <shajnocz@redhat.com>, =?iso-8859-1?q?Marc-Andr=E9?=\n\tLureau <marcandre.lureau@gmail.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>, \"Dr . David Alan Gilbert\"\n\t<dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1768928,"web_url":"http://patchwork.ozlabs.org/comment/1768928/","msgid":"<20170915025947.GL3617@pxdev.xzpeter.org>","list_archive_url":null,"date":"2017-09-15T02:59:47","subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","submitter":{"id":67717,"url":"http://patchwork.ozlabs.org/api/people/67717/","name":"Peter Xu","email":"peterx@redhat.com"},"content":"On Thu, Sep 14, 2017 at 04:33:34PM +0100, Stefan Hajnoczi wrote:\n> On Thu, Sep 14, 2017 at 03:50:35PM +0800, Peter Xu wrote:\n> > diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\n> > index 61fa167..47d16bb 100644\n> > --- a/docs/devel/qapi-code-gen.txt\n> > +++ b/docs/devel/qapi-code-gen.txt\n> > @@ -665,6 +665,16 @@ allowed to run out-of-band can also be introspected using\n> >  query-qmp-schema command.  Please see the section \"Client JSON\n> >  Protocol introspection\" for more information.\n> >  \n> > +To execute a command in out-of-band way, we need to specify the\n> > +\"control\" field in the request, with \"run-oob\" set to true. Example:\n> > +\n> > + => { \"execute\": \"command-support-oob\",\n> > +      \"arguments\": { ... },\n> > +      \"control\": { \"run-oob\": true } }\n> > + <= { \"return\": { } }\n> > +\n> > +Without it, even the commands that supports out-of-band execution will\n> > +still be run in-band.\n> \n> Is there a more relevant place to document QMP run-oob behavior than the\n> \"How to use the QAPI code generator document\"?\n\nI agree, but I don't really know it. :(\n\nMarkus, could you provide a hint?\n\n> \n> > @@ -3963,6 +3964,16 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens,\n> >      req_obj->id = id;\n> >      req_obj->req = req;\n> >  \n> > +    if (qmp_is_oob(req)) {\n> > +        /*\n> > +         * Trigger fast-path to handle the out-of-band request, by\n> > +         * executing the command directly in parser.\n> > +         */\n> > +        trace_monitor_qmp_cmd_out_of_band(qobject_get_str(req_obj->id));\n> > +        monitor_qmp_dispatch_one(req_obj);\n> > +        return;\n> > +    }\n> \n> A \"fast-path\" is a performance optimization.  OOB is not a performance\n> optimization, it changes the semantics of command execution.  Please\n> mention the semantics of OOB command execution instead.\n\nI'll remove the \"fast-path\" wording and try to think out something\nbetter than this comment.  After I know a good place to document, I\ncan put it there as well.  Thanks,","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=peterx@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xtgC91JCzz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 13:01:09 +1000 (AEST)","from localhost ([::1]:50885 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsgsN-0006Qv-8Q\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 23:01:07 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:46672)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dsgrM-0005dX-B3\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 23:00:05 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dsgrJ-0002fw-AM\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 23:00:04 -0400","from mx1.redhat.com ([209.132.183.28]:41380)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <peterx@redhat.com>) id 1dsgrJ-0002dr-23\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 23:00:01 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id A7BA3C04B30E;\n\tFri, 15 Sep 2017 02:59:59 +0000 (UTC)","from pxdev.xzpeter.org (ovpn-12-86.pek2.redhat.com [10.72.12.86])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id AEA166757F;\n\tFri, 15 Sep 2017 02:59:50 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com A7BA3C04B30E","Date":"Fri, 15 Sep 2017 10:59:47 +0800","From":"Peter Xu <peterx@redhat.com>","To":"Stefan Hajnoczi <stefanha@redhat.com>","Message-ID":"<20170915025947.GL3617@pxdev.xzpeter.org>","References":"<1505375436-28439-1-git-send-email-peterx@redhat.com>\n\t<1505375436-28439-15-git-send-email-peterx@redhat.com>\n\t<20170914153334.GC7370@stefanha-x1.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20170914153334.GC7370@stefanha-x1.localdomain>","User-Agent":"Mutt/1.5.24 (2015-08-30)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tFri, 15 Sep 2017 02:59:59 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tmdroth@linux.vnet.ibm.com, Juan Quintela <quintela@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org, Stefan\n\tHajnoczi <shajnocz@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9?=\n\tLureau <marcandre.lureau@gmail.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>, \"Dr . David Alan Gilbert\"\n\t<dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769281,"web_url":"http://patchwork.ozlabs.org/comment/1769281/","msgid":"<20170915155550.GS2170@work-vm>","list_archive_url":null,"date":"2017-09-15T15:55:51","subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","submitter":{"id":48102,"url":"http://patchwork.ozlabs.org/api/people/48102/","name":"Dr. David Alan Gilbert","email":"dgilbert@redhat.com"},"content":"* Peter Xu (peterx@redhat.com) wrote:\n> Having \"allow-oob\" to true for a command does not mean that this command\n> will always be run in out-of-band mode.  The out-of-band quick path will\n> only be executed if we specify the extra \"run-oob\" flag when sending the\n> QMP request:\n> \n>   { \"execute\": \"command-that-allows-oob\",\n>     \"arguments\": { ... },\n>     \"control\": { \"run-oob\": true } }\n> \n> The \"control\" key is introduced to store this extra flag.  \"control\"\n> field is used to store arguments that are shared by all the commands,\n> rather than command specific arguments.  Let \"run-oob\" be the first.\n> \n> Signed-off-by: Peter Xu <peterx@redhat.com>\n\nI don't understand how this enforces the allowoob, that is it stops\nother commands being called with run-oob=true\n\n> ---\n>  docs/devel/qapi-code-gen.txt | 10 ++++++++++\n>  include/qapi/qmp/dispatch.h  |  1 +\n>  monitor.c                    | 11 +++++++++++\n>  qapi/qmp-dispatch.c          | 34 ++++++++++++++++++++++++++++++++++\n>  trace-events                 |  2 ++\n>  5 files changed, 58 insertions(+)\n> \n> diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\n> index 61fa167..47d16bb 100644\n> --- a/docs/devel/qapi-code-gen.txt\n> +++ b/docs/devel/qapi-code-gen.txt\n> @@ -665,6 +665,16 @@ allowed to run out-of-band can also be introspected using\n>  query-qmp-schema command.  Please see the section \"Client JSON\n>  Protocol introspection\" for more information.\n>  \n> +To execute a command in out-of-band way, we need to specify the\n> +\"control\" field in the request, with \"run-oob\" set to true. Example:\n> +\n> + => { \"execute\": \"command-support-oob\",\n> +      \"arguments\": { ... },\n> +      \"control\": { \"run-oob\": true } }\n> + <= { \"return\": { } }\n> +\n> +Without it, even the commands that supports out-of-band execution will\n> +still be run in-band.\n>  \n>  === Events ===\n>  \n> diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h\n> index b767988..ee2b8ce 100644\n> --- a/include/qapi/qmp/dispatch.h\n> +++ b/include/qapi/qmp/dispatch.h\n> @@ -49,6 +49,7 @@ bool qmp_command_is_enabled(const QmpCommand *cmd);\n>  const char *qmp_command_name(const QmpCommand *cmd);\n>  bool qmp_has_success_response(const QmpCommand *cmd);\n>  QObject *qmp_build_error_object(Error *err);\n> +bool qmp_is_oob(const QObject *request);\n>  \n>  typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque);\n>  \n> diff --git a/monitor.c b/monitor.c\n> index 599ea36..cb96204 100644\n> --- a/monitor.c\n> +++ b/monitor.c\n> @@ -3928,6 +3928,7 @@ static void monitor_qmp_bh_dispatcher(void *data)\n>          if (!req_obj) {\n>              break;\n>          }\n> +        trace_monitor_qmp_cmd_in_band(qobject_get_str(req_obj->id));\n>          monitor_qmp_dispatch_one(req_obj);\n>      }\n>  }\n> @@ -3963,6 +3964,16 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens,\n>      req_obj->id = id;\n>      req_obj->req = req;\n>  \n> +    if (qmp_is_oob(req)) {\n> +        /*\n> +         * Trigger fast-path to handle the out-of-band request, by\n> +         * executing the command directly in parser.\n> +         */\n> +        trace_monitor_qmp_cmd_out_of_band(qobject_get_str(req_obj->id));\n> +        monitor_qmp_dispatch_one(req_obj);\n> +        return;\n> +    }\n\nI wonder if there is a way to run all allowoob commands in this way;\nthe only difference being if they're not started with run-oob\nyou wiat for completion of !oob commands.\nThat way the allowoob commands are always run from the same\nthread/context which feels like it should simplify them.\n\nDave\n\n>      /*\n>       * Put the request to the end of queue so that requests will be\n>       * handled in time order.  Ownership for req_obj, req, id,\n> diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c\n> index b41fa17..9a05dfa 100644\n> --- a/qapi/qmp-dispatch.c\n> +++ b/qapi/qmp-dispatch.c\n> @@ -52,6 +52,12 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)\n>                             \"QMP input member 'arguments' must be an object\");\n>                  return NULL;\n>              }\n> +        } else if (!strcmp(arg_name, \"control\")) {\n> +            if (qobject_type(arg_obj) != QTYPE_QDICT) {\n> +                error_setg(errp,\n> +                           \"QMP input member 'control' must be an object\");\n> +                return NULL;\n> +            }\n>          } else {\n>              error_setg(errp, \"QMP input member '%s' is unexpected\",\n>                         arg_name);\n> @@ -122,6 +128,34 @@ QObject *qmp_build_error_object(Error *err)\n>                                error_get_pretty(err));\n>  }\n>  \n> +/*\n> + * Detect whether a request should be run out-of-band, by quickly\n> + * peeking at whether we have: { \"control\": { \"run-oob\": True } }. By\n> + * default commands are run in-band.\n> + */\n> +bool qmp_is_oob(const QObject *request)\n> +{\n> +    QDict *dict;\n> +    QBool *bool_obj;\n> +\n> +    dict = qobject_to_qdict(request);\n> +    if (!dict) {\n> +        return false;\n> +    }\n> +\n> +    dict = qdict_get_qdict(dict, \"control\");\n> +    if (!dict) {\n> +        return false;\n> +    }\n> +\n> +    bool_obj = qobject_to_qbool(qdict_get(dict, \"run-oob\"));\n> +    if (!bool_obj) {\n> +        return false;\n> +    }\n> +\n> +    return qbool_get_bool(bool_obj);\n> +}\n> +\n>  QObject *qmp_dispatch(QmpCommandList *cmds, QObject *request)\n>  {\n>      Error *err = NULL;\n> diff --git a/trace-events b/trace-events\n> index 1f50f56..f7900a6 100644\n> --- a/trace-events\n> +++ b/trace-events\n> @@ -47,6 +47,8 @@ monitor_protocol_event_emit(uint32_t event, void *data) \"event=%d data=%p\"\n>  monitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) \"event=%d data=%p rate=%\" PRId64\n>  handle_hmp_command(void *mon, const char *cmdline) \"mon %p cmdline: %s\"\n>  handle_qmp_command(void *mon, const char *req) \"mon %p req: %s\"\n> +monitor_qmp_cmd_in_band(const char *id) \"%s\"\n> +monitor_qmp_cmd_out_of_band(const char *id) \"%s\"\n>  \n>  # dma-helpers.c\n>  dma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) \"dbs=%p bs=%p offset=%\" PRId64 \" to_dev=%d\"\n> -- \n> 2.7.4\n> \n--\nDr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=dgilbert@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xv0Py5Nqjz9sPs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 01:56:38 +1000 (AEST)","from localhost ([::1]:53933 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dssyq-0007ui-6P\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 11:56:36 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:60306)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1dssyP-0007sq-G3\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 11:56:11 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgilbert@redhat.com>) id 1dssyK-0004eF-GD\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 11:56:09 -0400","from mx1.redhat.com ([209.132.183.28]:58910)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgilbert@redhat.com>) id 1dssyK-0004dp-6t\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 11:56:04 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 151A2883CD;\n\tFri, 15 Sep 2017 15:56:03 +0000 (UTC)","from work-vm (ovpn-117-180.ams2.redhat.com [10.36.117.180])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 304D6704C9;\n\tFri, 15 Sep 2017 15:55:53 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 151A2883CD","Date":"Fri, 15 Sep 2017 16:55:51 +0100","From":"\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>","To":"Peter Xu <peterx@redhat.com>","Message-ID":"<20170915155550.GS2170@work-vm>","References":"<1505375436-28439-1-git-send-email-peterx@redhat.com>\n\t<1505375436-28439-15-git-send-email-peterx@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<1505375436-28439-15-git-send-email-peterx@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tFri, 15 Sep 2017 15:56:03 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tmdroth@linux.vnet.ibm.com, Juan Quintela <quintela@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org, Stefan\n\tHajnoczi <shajnocz@redhat.com>, =?iso-8859-1?q?Marc-Andr=E9?=\n\tLureau <marcandre.lureau@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769359,"web_url":"http://patchwork.ozlabs.org/comment/1769359/","msgid":"<a43ad04c-77f8-928c-949e-48129711154c@redhat.com>","list_archive_url":null,"date":"2017-09-15T18:34:24","subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/14/2017 09:59 PM, Peter Xu wrote:\n> On Thu, Sep 14, 2017 at 04:33:34PM +0100, Stefan Hajnoczi wrote:\n>> On Thu, Sep 14, 2017 at 03:50:35PM +0800, Peter Xu wrote:\n>>> diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\n>>> index 61fa167..47d16bb 100644\n>>> --- a/docs/devel/qapi-code-gen.txt\n>>> +++ b/docs/devel/qapi-code-gen.txt\n\n>>\n>> Is there a more relevant place to document QMP run-oob behavior than the\n>> \"How to use the QAPI code generator document\"?\n> \n> I agree, but I don't really know it. :(\n> \n> Markus, could you provide a hint?\n\nI'm not Markus, but I suggest docs/interop/qmp-spec.txt","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xv3xq1bdfz9sPs\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 04:35:59 +1000 (AEST)","from localhost ([::1]:54590 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsvT3-0007EE-At\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 14:35:57 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:45695)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dsvSP-0007AA-Eb\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 14:35:18 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dsvSK-0004Dc-RJ\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 14:35:17 -0400","from mx1.redhat.com ([209.132.183.28]:34250)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dsvSK-0004C3-9e\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 14:35:12 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 33DD781227;\n\tFri, 15 Sep 2017 18:35:11 +0000 (UTC)","from [10.10.124.97] (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 36FBB78A99;\n\tFri, 15 Sep 2017 18:34:25 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 33DD781227","To":"Peter Xu <peterx@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>","References":"<1505375436-28439-1-git-send-email-peterx@redhat.com>\n\t<1505375436-28439-15-git-send-email-peterx@redhat.com>\n\t<20170914153334.GC7370@stefanha-x1.localdomain>\n\t<20170915025947.GL3617@pxdev.xzpeter.org>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<a43ad04c-77f8-928c-949e-48129711154c@redhat.com>","Date":"Fri, 15 Sep 2017 13:34:24 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170915025947.GL3617@pxdev.xzpeter.org>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"XQUpnnWSVFxirpX6fLoH5vBd5Jxos9CjS\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tFri, 15 Sep 2017 18:35:11 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tmdroth@linux.vnet.ibm.com, Juan Quintela <quintela@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org, Stefan\n\tHajnoczi <shajnocz@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9_Lureau?=\n\t<marcandre.lureau@gmail.com>, \tPaolo Bonzini <pbonzini@redhat.com>,\n\t\"Dr . David Alan Gilbert\" <dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769917,"web_url":"http://patchwork.ozlabs.org/comment/1769917/","msgid":"<20170918073657.GA3617@pxdev.xzpeter.org>","list_archive_url":null,"date":"2017-09-18T07:36:57","subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","submitter":{"id":67717,"url":"http://patchwork.ozlabs.org/api/people/67717/","name":"Peter Xu","email":"peterx@redhat.com"},"content":"On Fri, Sep 15, 2017 at 01:34:24PM -0500, Eric Blake wrote:\n> On 09/14/2017 09:59 PM, Peter Xu wrote:\n> > On Thu, Sep 14, 2017 at 04:33:34PM +0100, Stefan Hajnoczi wrote:\n> >> On Thu, Sep 14, 2017 at 03:50:35PM +0800, Peter Xu wrote:\n> >>> diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\n> >>> index 61fa167..47d16bb 100644\n> >>> --- a/docs/devel/qapi-code-gen.txt\n> >>> +++ b/docs/devel/qapi-code-gen.txt\n> \n> >>\n> >> Is there a more relevant place to document QMP run-oob behavior than the\n> >> \"How to use the QAPI code generator document\"?\n> > \n> > I agree, but I don't really know it. :(\n> > \n> > Markus, could you provide a hint?\n> \n> I'm not Markus, but I suggest docs/interop/qmp-spec.txt\n\nSorry I should have noticed it before (I am always not sensitive on\nthe word \"interop\").  Thanks Eric!","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=peterx@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwdBj5XgSz9ryQ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 17:37:33 +1000 (AEST)","from localhost ([::1]:35059 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtqcV-0005ju-Tm\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 03:37:31 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:56517)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dtqcE-0005jj-8O\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:37:15 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dtqcB-0006Kp-6i\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:37:14 -0400","from mx1.redhat.com ([209.132.183.28]:51428)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <peterx@redhat.com>) id 1dtqcB-0006Jx-07\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:37:11 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id D0C9D4E049;\n\tMon, 18 Sep 2017 07:37:09 +0000 (UTC)","from pxdev.xzpeter.org (dhcp-15-224.nay.redhat.com [10.66.15.224])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id AAAA561342;\n\tMon, 18 Sep 2017 07:36:59 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com D0C9D4E049","Date":"Mon, 18 Sep 2017 15:36:57 +0800","From":"Peter Xu <peterx@redhat.com>","To":"Eric Blake <eblake@redhat.com>","Message-ID":"<20170918073657.GA3617@pxdev.xzpeter.org>","References":"<1505375436-28439-1-git-send-email-peterx@redhat.com>\n\t<1505375436-28439-15-git-send-email-peterx@redhat.com>\n\t<20170914153334.GC7370@stefanha-x1.localdomain>\n\t<20170915025947.GL3617@pxdev.xzpeter.org>\n\t<a43ad04c-77f8-928c-949e-48129711154c@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<a43ad04c-77f8-928c-949e-48129711154c@redhat.com>","User-Agent":"Mutt/1.5.24 (2015-08-30)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tMon, 18 Sep 2017 07:37:10 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tmdroth@linux.vnet.ibm.com, Juan Quintela <quintela@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org, Stefan\n\tHajnoczi <shajnocz@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9?=\n\tLureau <marcandre.lureau@gmail.com>, Stefan Hajnoczi\n\t<stefanha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, \"Dr . David\n\tAlan Gilbert\" <dgilbert@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1769935,"web_url":"http://patchwork.ozlabs.org/comment/1769935/","msgid":"<20170918075319.GB3617@pxdev.xzpeter.org>","list_archive_url":null,"date":"2017-09-18T07:53:19","subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","submitter":{"id":67717,"url":"http://patchwork.ozlabs.org/api/people/67717/","name":"Peter Xu","email":"peterx@redhat.com"},"content":"On Fri, Sep 15, 2017 at 04:55:51PM +0100, Dr. David Alan Gilbert wrote:\n> * Peter Xu (peterx@redhat.com) wrote:\n> > Having \"allow-oob\" to true for a command does not mean that this command\n> > will always be run in out-of-band mode.  The out-of-band quick path will\n> > only be executed if we specify the extra \"run-oob\" flag when sending the\n> > QMP request:\n> > \n> >   { \"execute\": \"command-that-allows-oob\",\n> >     \"arguments\": { ... },\n> >     \"control\": { \"run-oob\": true } }\n> > \n> > The \"control\" key is introduced to store this extra flag.  \"control\"\n> > field is used to store arguments that are shared by all the commands,\n> > rather than command specific arguments.  Let \"run-oob\" be the first.\n> > \n> > Signed-off-by: Peter Xu <peterx@redhat.com>\n> \n> I don't understand how this enforces the allowoob, that is it stops\n> other commands being called with run-oob=true\n\nHere's what I thought:\n\nOOB commands are executed directly in the parser, and currently we\nonly have one single parser/IO thread, then we can't have two oob\ncommands in parallel, can we? Say, if we got one OOB command, we won't\nhandle anything else (no matter OOB or non-OOB) before we finished\nprocessing that OOB command.\n\n> \n> > ---\n> >  docs/devel/qapi-code-gen.txt | 10 ++++++++++\n> >  include/qapi/qmp/dispatch.h  |  1 +\n> >  monitor.c                    | 11 +++++++++++\n> >  qapi/qmp-dispatch.c          | 34 ++++++++++++++++++++++++++++++++++\n> >  trace-events                 |  2 ++\n> >  5 files changed, 58 insertions(+)\n> > \n> > diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\n> > index 61fa167..47d16bb 100644\n> > --- a/docs/devel/qapi-code-gen.txt\n> > +++ b/docs/devel/qapi-code-gen.txt\n> > @@ -665,6 +665,16 @@ allowed to run out-of-band can also be introspected using\n> >  query-qmp-schema command.  Please see the section \"Client JSON\n> >  Protocol introspection\" for more information.\n> >  \n> > +To execute a command in out-of-band way, we need to specify the\n> > +\"control\" field in the request, with \"run-oob\" set to true. Example:\n> > +\n> > + => { \"execute\": \"command-support-oob\",\n> > +      \"arguments\": { ... },\n> > +      \"control\": { \"run-oob\": true } }\n> > + <= { \"return\": { } }\n> > +\n> > +Without it, even the commands that supports out-of-band execution will\n> > +still be run in-band.\n> >  \n> >  === Events ===\n> >  \n> > diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h\n> > index b767988..ee2b8ce 100644\n> > --- a/include/qapi/qmp/dispatch.h\n> > +++ b/include/qapi/qmp/dispatch.h\n> > @@ -49,6 +49,7 @@ bool qmp_command_is_enabled(const QmpCommand *cmd);\n> >  const char *qmp_command_name(const QmpCommand *cmd);\n> >  bool qmp_has_success_response(const QmpCommand *cmd);\n> >  QObject *qmp_build_error_object(Error *err);\n> > +bool qmp_is_oob(const QObject *request);\n> >  \n> >  typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque);\n> >  \n> > diff --git a/monitor.c b/monitor.c\n> > index 599ea36..cb96204 100644\n> > --- a/monitor.c\n> > +++ b/monitor.c\n> > @@ -3928,6 +3928,7 @@ static void monitor_qmp_bh_dispatcher(void *data)\n> >          if (!req_obj) {\n> >              break;\n> >          }\n> > +        trace_monitor_qmp_cmd_in_band(qobject_get_str(req_obj->id));\n> >          monitor_qmp_dispatch_one(req_obj);\n> >      }\n> >  }\n> > @@ -3963,6 +3964,16 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens,\n> >      req_obj->id = id;\n> >      req_obj->req = req;\n> >  \n> > +    if (qmp_is_oob(req)) {\n> > +        /*\n> > +         * Trigger fast-path to handle the out-of-band request, by\n> > +         * executing the command directly in parser.\n> > +         */\n> > +        trace_monitor_qmp_cmd_out_of_band(qobject_get_str(req_obj->id));\n> > +        monitor_qmp_dispatch_one(req_obj);\n> > +        return;\n> > +    }\n> \n> I wonder if there is a way to run all allowoob commands in this way;\n> the only difference being if they're not started with run-oob\n> you wiat for completion of !oob commands.\n> That way the allowoob commands are always run from the same\n> thread/context which feels like it should simplify them.\n\nMaybe I misread the comment... Even with current patch, all OOB\ncommands will be run from the same thread/context (which is the newly\ncreated parser thread), right?  Thanks,","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=peterx@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwdYj5r7Xz9s7G\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 17:54:01 +1000 (AEST)","from localhost ([::1]:35124 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtqsQ-0005iS-5Z\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 03:53:58 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:60686)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dtqrz-0005gY-Uj\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:53:33 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dtqrw-0003vC-RC\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:53:32 -0400","from mx1.redhat.com ([209.132.183.28]:47068)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <peterx@redhat.com>) id 1dtqrw-0003um-IJ\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 03:53:28 -0400","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 8257F80469;\n\tMon, 18 Sep 2017 07:53:27 +0000 (UTC)","from pxdev.xzpeter.org (dhcp-15-224.nay.redhat.com [10.66.15.224])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 3A34D5D9CB;\n\tMon, 18 Sep 2017 07:53:21 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 8257F80469","Date":"Mon, 18 Sep 2017 15:53:19 +0800","From":"Peter Xu <peterx@redhat.com>","To":"\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>","Message-ID":"<20170918075319.GB3617@pxdev.xzpeter.org>","References":"<1505375436-28439-1-git-send-email-peterx@redhat.com>\n\t<1505375436-28439-15-git-send-email-peterx@redhat.com>\n\t<20170915155550.GS2170@work-vm>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20170915155550.GS2170@work-vm>","User-Agent":"Mutt/1.5.24 (2015-08-30)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.14","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tMon, 18 Sep 2017 07:53:27 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob)\n\texecution","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Laurent Vivier <lvivier@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tmdroth@linux.vnet.ibm.com, Juan Quintela <quintela@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org, Stefan\n\tHajnoczi <shajnocz@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9?=\n\tLureau <marcandre.lureau@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]