Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/813087/?format=api
{ "id": 813087, "url": "http://patchwork.ozlabs.org/api/patches/813087/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/150525179869.15988.10803736017266867796.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": "<150525179869.15988.10803736017266867796.stgit@frigg.lan>", "list_archive_url": null, "date": "2017-09-12T21:29:58", "name": "[v5,07/22] instrument: [qapi] Add library loader", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "750aef7bedc32a8bc0a78612f815838ff104497e", "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/150525179869.15988.10803736017266867796.stgit@frigg.lan/mbox/", "series": [ { "id": 2775, "url": "http://patchwork.ozlabs.org/api/series/2775/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2775", "date": "2017-09-12T21:01:42", "name": "instrument: Add basic event instrumentation", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/2775/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/813087/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/813087/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 3xsHyd56GSz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 07:30:33 +1000 (AEST)", "from localhost ([::1]:38696 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 1drslL-0000va-Rj\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 17:30:31 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:38211)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1drsl3-0000vB-Kn\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 17:30:15 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1drskz-0002XW-Am\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 17:30:13 -0400", "from roura.ac.upc.es ([147.83.33.10]:42121)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1drsky-0002WC-SB\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 17:30:09 -0400", "from correu-2.ac.upc.es (correu-2.ac.upc.es [147.83.30.92])\n\tby roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v8CLU5ug022360;\n\tTue, 12 Sep 2017 23:30:05 +0200", "from localhost (unknown [31.210.187.58])\n\tby correu-2.ac.upc.es (Postfix) with ESMTPSA id 20DBF25B;\n\tTue, 12 Sep 2017 23:29:59 +0200 (CEST)" ], "From": "=?utf-8?b?TGx1w61z?= Vilanova <vilanova@ac.upc.edu>", "To": "qemu-devel@nongnu.org", "Date": "Wed, 13 Sep 2017 00:29:58 +0300", "Message-Id": "<150525179869.15988.10803736017266867796.stgit@frigg.lan>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<150525010239.15988.8172586618197849619.stgit@frigg.lan>", "References": "<150525010239.15988.8172586618197849619.stgit@frigg.lan>", "User-Agent": "StGit/0.18", "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\tv8CLU5ug022360", "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 v5 07/22] 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": "\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>, Markus Armbruster\n\t<armbru@redhat.com>, \"Emilio G. Cota\" <cota@braap.org>, Stefan Hajnoczi\n\t<stefanha@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, \n\t=?utf-8?q?Llu=C3=ADs_Vilanova?= <vilanova@ac.upc.edu>", "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 MAINTAINERS | 1 +\n Makefile | 1 +\n instrument/Makefile.objs | 1 +\n instrument/qmp.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++\n monitor.c | 4 ++\n qapi-schema.json | 3 ++\n qapi/instrument.json | 49 +++++++++++++++++++++++++++\n stubs/instrument.c | 26 +++++++++++++++\n 8 files changed, 167 insertions(+)\n create mode 100644 instrument/qmp.c\n create mode 100644 qapi/instrument.json", "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex 6c0b12a69a..edddab0502 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -1492,6 +1492,7 @@ M: Stefan Hajnoczi <stefanha@redhat.com>\n S: Maintained\n F: docs/instrument.txt\n F: instrument/\n+F: qapi/instrument.json\n \n TPM\n S: Orphan\ndiff --git a/Makefile b/Makefile\nindex 337a1f6f9b..3861b3f49c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -412,6 +412,7 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \\\n $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \\\n $(SRC_PATH)/qapi/char.json \\\n $(SRC_PATH)/qapi/crypto.json \\\n+ $(SRC_PATH)/qapi/instrument.json \\\n $(SRC_PATH)/qapi/introspect.json \\\n $(SRC_PATH)/qapi/migration.json \\\n $(SRC_PATH)/qapi/net.json \\\ndiff --git a/instrument/Makefile.objs b/instrument/Makefile.objs\nindex 71994a4c85..7bf4e27e3c 100644\n--- a/instrument/Makefile.objs\n+++ b/instrument/Makefile.objs\n@@ -2,3 +2,4 @@\n \n target-obj-$(CONFIG_INSTRUMENT) += cmdline.o\n target-obj-$(CONFIG_INSTRUMENT) += load.o\n+target-obj-$(CONFIG_INSTRUMENT) += qmp.o\ndiff --git a/instrument/qmp.c b/instrument/qmp.c\nnew file mode 100644\nindex 0000000000..e4464aa5eb\n--- /dev/null\n+++ b/instrument/qmp.c\n@@ -0,0 +1,82 @@\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 <dlfcn.h>\n+\n+#include \"instrument/load.h\"\n+#include \"qemu-common.h\"\n+#include \"qapi/qmp/qerror.h\"\n+#include \"qmp-commands.h\"\n+\n+\n+InstrLoadResult *qmp_instr_load(const char *path,\n+ bool has_id, const char *id,\n+ bool have_args, strList *args,\n+ Error **errp)\n+{\n+ InstrLoadResult *res = g_malloc0(sizeof(*res));\n+ int argc = 0;\n+ const char **argv = NULL;\n+ InstrLoadError code;\n+\n+ if (!has_id) {\n+ id = NULL;\n+ }\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+ code = instr_load(path, argc, argv, &id);\n+ switch (code) {\n+ case INSTR_LOAD_OK:\n+ res->id = g_strdup(id);\n+ break;\n+ case INSTR_LOAD_ID_EXISTS:\n+ error_setg(errp, \"Library ID exists\");\n+ break;\n+ case INSTR_LOAD_TOO_MANY:\n+ error_setg(errp, \"Tried to load too many libraries\");\n+ break;\n+ case INSTR_LOAD_ERROR:\n+ error_setg(errp, \"Library initialization returned non-zero\");\n+ break;\n+ case INSTR_LOAD_DLERROR:\n+ error_setg(errp, \"Error loading library: %s\",\n+ dlerror());\n+ break;\n+ }\n+\n+ if (*errp) {\n+ g_free(res);\n+ res = NULL;\n+ }\n+\n+ return res;\n+}\n+\n+void qmp_instr_unload(const char *id, Error **errp)\n+{\n+ InstrUnloadError code = instr_unload(id);\n+ switch (code) {\n+ case INSTR_UNLOAD_OK:\n+ break;\n+ case INSTR_UNLOAD_INVALID:\n+ error_setg(errp, \"Unknown library ID\");\n+ break;\n+ case INSTR_UNLOAD_DLERROR:\n+ error_setg(errp, \"Error unloading library: %s\", dlerror());\n+ break;\n+ }\n+}\ndiff --git a/monitor.c b/monitor.c\nindex 9239f7adde..e031aa2687 100644\n--- a/monitor.c\n+++ b/monitor.c\n@@ -978,6 +978,10 @@ static void qmp_unregister_commands_hack(void)\n qmp_unregister_command(&qmp_commands, \"query-xen-replication-status\");\n qmp_unregister_command(&qmp_commands, \"xen-colo-do-checkpoint\");\n #endif\n+#ifndef CONFIG_INSTRUMENT\n+ qmp_unregister_command(&qmp_commands, \"instr-load\");\n+ qmp_unregister_command(&qmp_commands, \"instr-unload\");\n+#endif\n #ifndef TARGET_I386\n qmp_unregister_command(&qmp_commands, \"rtc-reset-reinjection\");\n #endif\ndiff --git a/qapi-schema.json b/qapi-schema.json\nindex f3af2cb851..706c64659f 100644\n--- a/qapi-schema.json\n+++ b/qapi-schema.json\n@@ -93,6 +93,9 @@\n { 'include': 'qapi/trace.json' }\n { 'include': 'qapi/introspect.json' }\n \n+# Instrumentation commands\n+{ 'include': 'qapi/instrument.json' }\n+\n ##\n # = Miscellanea\n ##\ndiff --git a/qapi/instrument.json b/qapi/instrument.json\nnew file mode 100644\nindex 0000000000..c59bee74cb\n--- /dev/null\n+++ b/qapi/instrument.json\n@@ -0,0 +1,49 @@\n+# *-*- Mode: Python -*-*\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+# QAPI instrumentation control commands.\n+##\n+\n+##\n+# @InstrLoadResult:\n+#\n+# Result of an 'instr-load' command.\n+#\n+# @id: instrumentation library ID\n+#\n+# Since: 2.11\n+##\n+{ 'struct': 'InstrLoadResult',\n+ 'data': { 'id': 'str' } }\n+\n+##\n+# @instr-load:\n+#\n+# Load an instrumentation library.\n+#\n+# @path: path to the dynamic instrumentation library\n+# @id: unique ID for the loaded library\n+# @args: arguments to the dynamic instrumentation library\n+#\n+# Since: 2.11\n+##\n+{ 'command': 'instr-load',\n+ 'data': { 'path': 'str', '*id': 'str', '*args': ['str'] },\n+ 'returns': 'InstrLoadResult' }\n+\n+##\n+# @instr-unload:\n+#\n+# Unload an instrumentation library.\n+#\n+# @id: unique ID passed to instr-load().\n+#\n+# Since: 2.11\n+##\n+{ 'command': 'instr-unload',\n+ 'data': { 'id': 'str' } }\ndiff --git a/stubs/instrument.c b/stubs/instrument.c\nindex 7d66f75454..79cd0fd2d1 100644\n--- a/stubs/instrument.c\n+++ b/stubs/instrument.c\n@@ -7,7 +7,15 @@\n * See the COPYING file in the top-level directory.\n */\n \n+#include \"qemu/osdep.h\"\n+\n #include \"instrument/cmdline.h\"\n+#include \"qapi/error.h\"\n+#include \"qapi/qmp/qerror.h\"\n+\n+\n+/* Declare missing types */\n+typedef struct strList strList;\n \n \n void instr_init(const char *path, int argc, const char **argv)\n@@ -16,3 +24,21 @@ void instr_init(const char *path, int argc, const char **argv)\n void instr_fini(void)\n {\n }\n+\n+InstrLoadResult *qmp_instr_load(const char *path,\n+ bool has_id, const char *id,\n+ bool have_args, strList *args,\n+ Error **errp);\n+InstrLoadResult *qmp_instr_load(const char *path,\n+ bool has_id, const char *id,\n+ bool have_args, strList *args,\n+ Error **errp)\n+{\n+ error_setg(errp, QERR_UNSUPPORTED);\n+ return NULL;\n+}\n+void qmp_instr_unload(const char *id, Error **errp);\n+void qmp_instr_unload(const char *id, Error **errp)\n+{\n+ error_setg(errp, QERR_UNSUPPORTED);\n+}\n", "prefixes": [ "v5", "07/22" ] }