Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/810741/?format=api
{ "id": 810741, "url": "http://patchwork.ozlabs.org/api/patches/810741/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/150472025751.24907.6133235993130047929.stgit@frigg.lan/", "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": "<150472025751.24907.6133235993130047929.stgit@frigg.lan>", "list_archive_url": null, "date": "2017-09-06T17:50:57", "name": "[v4,07/20] instrument: [qapi] Add library loader", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f397d5f1b11ecd16668ca07f44a25b40b9ff5a2a", "submitter": { "id": 9099, "url": "http://patchwork.ozlabs.org/api/people/9099/?format=api", "name": "Lluís Vilanova", "email": "vilanova@ac.upc.edu" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/150472025751.24907.6133235993130047929.stgit@frigg.lan/mbox/", "series": [ { "id": 1859, "url": "http://patchwork.ozlabs.org/api/series/1859/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=1859", "date": "2017-09-06T17:22:41", "name": "instrument: Add basic event instrumentation", "version": 4, "mbox": "http://patchwork.ozlabs.org/series/1859/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/810741/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/810741/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>)", "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 3xnWNw727Gz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 7 Sep 2017 03:51:44 +1000 (AEST)", "from localhost ([::1]:37325 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 1dpeUI-0000F7-TO\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 13:51:42 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:41657)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1dpeTp-0000EX-VC\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 13:51:19 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1dpeTl-0005pB-2i\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 13:51:14 -0400", "from roura.ac.upc.es ([147.83.33.10]:41489)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1dpeTk-0005oB-Id\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 13:51:08 -0400", "from correu-1.ac.upc.es (correu-1.ac.upc.es [147.83.30.91])\n\tby roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v86Hp4r2004372;\n\tWed, 6 Sep 2017 19:51:04 +0200", "from localhost (unknown [31.210.187.58])\n\tby correu-1.ac.upc.es (Postfix) with ESMTPSA id 36F8E11D;\n\tWed, 6 Sep 2017 19:50:59 +0200 (CEST)" ], "From": "=?utf-8?b?TGx1w61z?= Vilanova <vilanova@ac.upc.edu>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 6 Sep 2017 20:50:57 +0300", "Message-Id": "<150472025751.24907.6133235993130047929.stgit@frigg.lan>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<150471856141.24907.274176769201097378.stgit@frigg.lan>", "References": "<150471856141.24907.274176769201097378.stgit@frigg.lan>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "quoted-printable", "X-MIME-Autoconverted": "from 8bit to quoted-printable by roura.ac.upc.es id\n\tv86Hp4r2004372", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy]", "X-Received-From": "147.83.33.10", "Subject": "[Qemu-devel] [PATCH v4 07/20] instrument: [qapi] Add library loader", "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": "\"Emilio G. Cota\" <cota@braap.org>, =?utf-8?q?Llu=C3=ADs_Vilanova?=\n\t<vilanova@ac.upc.edu>, \tStefan Hajnoczi <stefanha@redhat.com>,\n\tMarkus Armbruster <armbru@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": "Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>\n---\n instrument/Makefile.objs | 1 \n instrument/load.h | 4 ++\n instrument/qmp.c | 88 ++++++++++++++++++++++++++++++++++++++++++\n qapi-schema.json | 3 +\n qapi/instrument.json | 96 ++++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 192 insertions(+)\n create mode 100644 instrument/qmp.c\n create mode 100644 qapi/instrument.json", "diff": "diff --git a/instrument/Makefile.objs b/instrument/Makefile.objs\nindex 5ea5c77245..13a8f60431 100644\n--- a/instrument/Makefile.objs\n+++ b/instrument/Makefile.objs\n@@ -2,3 +2,4 @@\n \n target-obj-y += cmdline.o\n target-obj-$(CONFIG_INSTRUMENT) += load.o\n+target-obj-y += qmp.o\ndiff --git a/instrument/load.h b/instrument/load.h\nindex 2ddb2c6c19..f8a02e6849 100644\n--- a/instrument/load.h\n+++ b/instrument/load.h\n@@ -25,6 +25,8 @@\n * @INSTR_LOAD_DLERROR: Error with libdl (see dlerror).\n *\n * Error codes for instr_load().\n+ *\n+ * NOTE: Keep in sync with QAPI's #InstrLoadCode.\n */\n typedef enum {\n INSTR_LOAD_OK,\n@@ -40,6 +42,8 @@ typedef enum {\n * @INSTR_UNLOAD_DLERROR: Error with libdl (see dlerror).\n *\n * Error codes for instr_unload().\n+ *\n+ * NOTE: Keep in sync with QAPI's #InstrUnloadCode.\n */\n typedef enum {\n INSTR_UNLOAD_OK,\ndiff --git a/instrument/qmp.c b/instrument/qmp.c\nnew file mode 100644\nindex 0000000000..c36960c12f\n--- /dev/null\n+++ b/instrument/qmp.c\n@@ -0,0 +1,88 @@\n+/*\n+ * QMP interface for instrumentation control commands.\n+ *\n+ * Copyright (C) 2012-2017 Lluís Vilanova <vilanova@ac.upc.edu>\n+ *\n+ * This work is licensed under the terms of the GNU GPL, version 2 or later.\n+ * See the COPYING file in the top-level directory.\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"qemu-common.h\"\n+#include \"qapi/qmp/qerror.h\"\n+#include \"qmp-commands.h\"\n+\n+#include <dlfcn.h>\n+\n+#include \"instrument/load.h\"\n+\n+\n+\n+InstrLoadResult *qmp_instr_load(const char * path,\n+ bool have_args, strList * args,\n+ Error **errp)\n+{\n+ InstrLoadResult *res = g_malloc0(sizeof(*res));\n+\n+#if defined(CONFIG_INSTRUMENT)\n+ int argc = 0;\n+ const char **argv = NULL;\n+\n+ strList *entry = have_args ? args : NULL;\n+ while (entry != NULL) {\n+ argv = realloc(argv, sizeof(*argv) * (argc + 1));\n+ argv[argc] = entry->value;\n+ argc++;\n+ entry = entry->next;\n+ }\n+\n+ InstrLoadError code = instr_load(path, argc, argv, &res->handle);\n+ switch (code) {\n+ case INSTR_LOAD_OK:\n+ res->code = INSTR_LOAD_CODE_OK;\n+ res->has_handle = true;\n+ break;\n+ case INSTR_LOAD_TOO_MANY:\n+ res->code = INSTR_LOAD_CODE_TOO_MANY;\n+ break;\n+ case INSTR_LOAD_ERROR:\n+ res->code = INSTR_LOAD_CODE_ERROR;\n+ break;\n+ case INSTR_LOAD_DLERROR:\n+ res->has_msg = true;\n+ res->msg = dlerror();\n+ res->code = INSTR_LOAD_CODE_DLERROR;\n+ break;\n+ }\n+#else\n+ res->code = INSTR_LOAD_CODE_UNAVAILABLE;\n+#endif\n+\n+ return res;\n+}\n+\n+InstrUnloadResult *qmp_instr_unload(int64_t handle, Error **errp)\n+{\n+ InstrUnloadResult *res = g_malloc0(sizeof(*res));\n+\n+#if defined(CONFIG_INSTRUMENT)\n+ InstrUnloadError code = instr_unload(handle);\n+ switch (code) {\n+ case INSTR_UNLOAD_OK:\n+ res->code = INSTR_UNLOAD_CODE_OK;\n+ break;\n+ case INSTR_UNLOAD_INVALID:\n+ res->code = INSTR_UNLOAD_CODE_INVALID;\n+ break;\n+ case INSTR_UNLOAD_DLERROR:\n+ res->has_msg = true;\n+ res->msg = dlerror();\n+ break;\n+ res->code = INSTR_UNLOAD_CODE_DLERROR;\n+ }\n+#else\n+ res->code = INSTR_UNLOAD_CODE_UNAVAILABLE;\n+#endif\n+\n+ return res;\n+}\ndiff --git a/qapi-schema.json b/qapi-schema.json\nindex 802ea53d00..5e343be9ff 100644\n--- a/qapi-schema.json\n+++ b/qapi-schema.json\n@@ -90,6 +90,9 @@\n # QAPI introspection\n { 'include': 'qapi/introspect.json' }\n \n+# Instrumentation commands\n+{ 'include': 'qapi/instrument.json' }\n+\n ##\n # = QMP commands\n ##\ndiff --git a/qapi/instrument.json b/qapi/instrument.json\nnew file mode 100644\nindex 0000000000..ea63fae309\n--- /dev/null\n+++ b/qapi/instrument.json\n@@ -0,0 +1,96 @@\n+# *-*- Mode: Python -*-*\n+#\n+# QAPI instrumentation control commands.\n+#\n+# Copyright (C) 2012-2017 Lluís Vilanova <vilanova@ac.upc.edu>\n+#\n+# This work is licensed under the terms of the GNU GPL, version 2 or later.\n+# See the COPYING file in the top-level directory.\n+\n+##\n+# @InstrLoadCode:\n+#\n+# Result code of an 'instr-load' command.\n+#\n+# @ok: Correctly loaded.\n+# @too-many: Tried to load too many instrumentation libraries.\n+# @error: The library's main() function returned a non-zero value.\n+# @dlerror: Error with libdl (see 'msg').\n+# @unavailable: Service not available.\n+#\n+# Since: 2.11\n+##\n+{ 'enum': 'InstrLoadCode',\n+ 'data': [ 'ok', 'too-many', 'error', 'dlerror', 'unavailable' ] }\n+\n+##\n+# @InstrLoadResult:\n+#\n+# Result of an 'instr-load' command.\n+#\n+# @code: Result code.\n+# @msg: Additional error message (for human consumption only; present only in\n+# case of error).\n+# @handle: Instrumentation library identifier (present only if successful).\n+#\n+# Since: 2.11\n+##\n+{ 'struct': 'InstrLoadResult',\n+ 'data': { 'code': 'InstrLoadCode', '*msg': 'str', '*handle': 'int' } }\n+\n+##\n+# @instr-load:\n+#\n+# Load an instrumentation library.\n+#\n+# @path: path to the dynamic instrumentation library\n+# @args: arguments to the dynamic instrumentation library\n+#\n+# Since: 2.11\n+##\n+{ 'command': 'instr-load',\n+ 'data': { 'path': 'str', '*args': ['str'] },\n+ 'returns': 'InstrLoadResult' }\n+\n+\n+##\n+# @InstrUnloadCode:\n+#\n+# Result code of an 'instr-unload' command.\n+#\n+# @ok: Correctly unloaded.\n+# @invalid: Invalid handle.\n+# @dlerror: Error with libdl (see 'msg').\n+# @unavailable: Service not available.\n+#\n+# Since: 2.11\n+##\n+{ 'enum': 'InstrUnloadCode',\n+ 'data': [ 'ok', 'invalid', 'dlerror', 'unavailable' ] }\n+\n+##\n+# @InstrUnloadResult:\n+#\n+# Result of an 'instr-unload' command.\n+#\n+# @code: Result code.\n+# @msg: Additional error message (for human consumption only; present only in\n+# case of error).\n+#\n+# Since: 2.11\n+##\n+{ 'struct': 'InstrUnloadResult',\n+ 'data': { 'code': 'InstrUnloadCode', '*msg': 'str' } }\n+\n+##\n+# @instr-unload:\n+#\n+# Unload an instrumentation library.\n+#\n+# @handle: Instrumentation library identifier (see #InstrLoadResult).\n+#\n+# Since: 2.11\n+##\n+{ 'command': 'instr-unload',\n+ 'data': { 'handle': 'int' },\n+ 'returns': 'InstrUnloadResult' }\n", "prefixes": [ "v4", "07/20" ] }