Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813735/?format=api
{ "id": 813735, "url": "http://patchwork.ozlabs.org/api/patches/813735/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505375436-28439-15-git-send-email-peterx@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1505375436-28439-15-git-send-email-peterx@redhat.com>", "list_archive_url": null, "date": "2017-09-14T07:50:35", "name": "[RFC,14/15] qmp: support out-of-band (oob) execution", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "beca4e558696856800f8c66c1ccfec94ea4b0fcc", "submitter": { "id": 67717, "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api", "name": "Peter Xu", "email": "peterx@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505375436-28439-15-git-send-email-peterx@redhat.com/mbox/", "series": [ { "id": 3043, "url": "http://patchwork.ozlabs.org/api/series/3043/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3043", "date": "2017-09-14T07:50:21", "name": "QMP: out-of-band (OOB) execution support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3043/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813735/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813735/checks/", "tags": {}, "related": [], "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-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx05.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 3xt9sY41kKz9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 17:59:13 +1000 (AEST)", "from localhost ([::1]:46216 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 1dsP3H-0005Xi-Jm\n\tfor incoming@patchwork.ozlabs.org; Thu, 14 Sep 2017 03:59:11 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:52925)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dsOwk-0007fq-TC\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 03:52:28 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peterx@redhat.com>) id 1dsOwh-0008SV-Oy\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 03:52:26 -0400", "from mx1.redhat.com ([209.132.183.28]:34400)\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 1dsOwh-0008RE-HE\n\tfor qemu-devel@nongnu.org; Thu, 14 Sep 2017 03:52:23 -0400", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\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 843FFA78C;\n\tThu, 14 Sep 2017 07:52:22 +0000 (UTC)", "from pxdev.xzpeter.org.com (dhcp-15-224.nay.redhat.com\n\t[10.66.15.224])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id DD511619B8;\n\tThu, 14 Sep 2017 07:52:16 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 843FFA78C", "From": "Peter Xu <peterx@redhat.com>", "To": "qemu-devel@nongnu.org", "Date": "Thu, 14 Sep 2017 15:50:35 +0800", "Message-Id": "<1505375436-28439-15-git-send-email-peterx@redhat.com>", "In-Reply-To": "<1505375436-28439-1-git-send-email-peterx@redhat.com>", "References": "<1505375436-28439-1-git-send-email-peterx@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tThu, 14 Sep 2017 07:52:22 +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": "[Qemu-devel] [RFC 14/15] qmp: support out-of-band (oob) execution", "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>, Juan\n\tQuintela <quintela@redhat.com>, Markus Armbruster <armbru@redhat.com>,\n\tpeterx@redhat.com, mdroth@linux.vnet.ibm.com,\n\tStefan Hajnoczi <shajnocz@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9_Lure?=\n\t=?utf-8?q?au?= <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>" }, "content": "Having \"allow-oob\" to true for a command does not mean that this command\nwill always be run in out-of-band mode. The out-of-band quick path will\nonly be executed if we specify the extra \"run-oob\" flag when sending the\nQMP request:\n\n { \"execute\": \"command-that-allows-oob\",\n \"arguments\": { ... },\n \"control\": { \"run-oob\": true } }\n\nThe \"control\" key is introduced to store this extra flag. \"control\"\nfield is used to store arguments that are shared by all the commands,\nrather than command specific arguments. Let \"run-oob\" be the first.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\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(+)", "diff": "diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt\nindex 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 \ndiff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h\nindex 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 \ndiff --git a/monitor.c b/monitor.c\nindex 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 /*\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,\ndiff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c\nindex 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;\ndiff --git a/trace-events b/trace-events\nindex 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", "prefixes": [ "RFC", "14/15" ] }