get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/810750/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 810750,
    "url": "http://patchwork.ozlabs.org/api/patches/810750/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/150472171121.24907.12569584037182483614.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": "<150472171121.24907.12569584037182483614.stgit@frigg.lan>",
    "list_archive_url": null,
    "date": "2017-09-06T18:15:11",
    "name": "[v4,13/20] instrument: Add event 'guest_cpu_exit'",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "dd93eea871aefbae74dc9064f0b70890746252bc",
    "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/150472171121.24907.12569584037182483614.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/810750/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/810750/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 3xnWwh0QD7z9sNd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 04:15:48 +1000 (AEST)",
            "from localhost ([::1]:37397 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 1dperZ-00029V-DM\n\tfor incoming@patchwork.ozlabs.org; Wed, 06 Sep 2017 14:15:45 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:48849)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1dperG-000295-WC\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:15:28 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1dperC-0004Jk-T2\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:15:26 -0400",
            "from roura.ac.upc.es ([147.83.33.10]:47387)\n\tby eggs.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <vilanova@ac.upc.edu>) id 1dperC-0004JX-Hc\n\tfor qemu-devel@nongnu.org; Wed, 06 Sep 2017 14:15:22 -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 v86IFIB6004929;\n\tWed, 6 Sep 2017 20:15:18 +0200",
            "from localhost (unknown [31.210.187.58])\n\tby correu-1.ac.upc.es (Postfix) with ESMTPSA id 5A4067FD;\n\tWed,  6 Sep 2017 20:15:13 +0200 (CEST)"
        ],
        "From": "=?utf-8?b?TGx1w61z?= Vilanova <vilanova@ac.upc.edu>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Wed,  6 Sep 2017 21:15:11 +0300",
        "Message-Id": "<150472171121.24907.12569584037182483614.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\tv86IFIB6004929",
        "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 13/20] instrument: Add event 'guest_cpu_exit'",
        "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": "Paolo Bonzini <pbonzini@redhat.com>, \"Emilio G. Cota\" <cota@braap.org>,\n\t=?utf-8?q?Llu=C3=ADs_Vilanova?= <vilanova@ac.upc.edu>,\n\tStefan Hajnoczi <stefanha@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/control.c            |    9 +++++++++\n instrument/events.h             |    3 +++\n instrument/events.inc.h         |   11 +++++++++++\n instrument/load.c               |    1 +\n instrument/qemu-instr/control.h |    9 +++++++++\n stubs/instrument.c              |    1 +\n trace/control.c                 |    4 +++-\n 7 files changed, 37 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/instrument/control.c b/instrument/control.c\nindex ed0d537b88..09ba682483 100644\n--- a/instrument/control.c\n+++ b/instrument/control.c\n@@ -57,3 +57,12 @@ QI_VPUBLIC void qi_event_set_guest_cpu_enter(void (*fn)(QICPU vcpu))\n     ERROR_IF(!instr_get_state(), \"called outside instrumentation\");\n     instr_set_event(guest_cpu_enter, fn);\n }\n+\n+\n+void (*instr_event__guest_cpu_exit)(QICPU vcpu);\n+\n+QI_VPUBLIC void qi_event_set_guest_cpu_exit(void (*fn)(QICPU vcpu))\n+{\n+    ERROR_IF(!instr_get_state(), \"called outside instrumentation\");\n+    instr_set_event(guest_cpu_exit, fn);\n+}\ndiff --git a/instrument/events.h b/instrument/events.h\nindex 947f120aa9..c743cb8180 100644\n--- a/instrument/events.h\n+++ b/instrument/events.h\n@@ -36,6 +36,9 @@ extern void *instr_event__fini_data;\n extern void (*instr_event__guest_cpu_enter)(QICPU vcpu);\n static inline void instr_guest_cpu_enter(CPUState *vcpu);\n \n+extern void (*instr_event__guest_cpu_exit)(QICPU vcpu);\n+static inline void instr_guest_cpu_exit(CPUState *vcpu);\n+\n \n #include \"instrument/events.inc.h\"\n \ndiff --git a/instrument/events.inc.h b/instrument/events.inc.h\nindex 238cce9855..bcbf0cb32a 100644\n--- a/instrument/events.inc.h\n+++ b/instrument/events.inc.h\n@@ -20,3 +20,14 @@ static inline void instr_guest_cpu_enter(CPUState *vcpu)\n         instr_set_state(INSTR_STATE_DISABLE);\n     }\n }\n+\n+static inline void instr_guest_cpu_exit(CPUState *vcpu)\n+{\n+    void (*cb)(QICPU vcpu) = instr_get_event(guest_cpu_exit);\n+    if (cb) {\n+        QICPU vcpu_ = instr_cpu_set(vcpu);\n+        instr_set_state(INSTR_STATE_ENABLE);\n+        (*cb)(vcpu_);\n+        instr_set_state(INSTR_STATE_DISABLE);\n+    }\n+}\ndiff --git a/instrument/load.c b/instrument/load.c\nindex 0fe878afa8..63b7d564ec 100644\n--- a/instrument/load.c\n+++ b/instrument/load.c\n@@ -149,6 +149,7 @@ InstrUnloadError instr_unload(int64_t handle_id)\n \n     instr_set_event(fini_fn, NULL);\n     instr_set_event(guest_cpu_enter, NULL);\n+    instr_set_event(guest_cpu_exit, NULL);\n \n     /* this should never fail */\n     if (dlclose(handle->dlhandle) < 0) {\ndiff --git a/instrument/qemu-instr/control.h b/instrument/qemu-instr/control.h\nindex 26d8aa976d..c37a380ab0 100644\n--- a/instrument/qemu-instr/control.h\n+++ b/instrument/qemu-instr/control.h\n@@ -80,6 +80,15 @@ void qi_set_fini(qi_fini_fn fn, void *data);\n  */\n void qi_event_set_guest_cpu_enter(void (*fn)(QICPU vcpu));\n \n+/*\n+ * Hot-unplug a virtual (guest) CPU.\n+ *\n+ * Mode: user, softmmu\n+ * Targets: all\n+ * Time: exec\n+ */\n+void qi_event_set_guest_cpu_exit(void (*fn)(QICPU vcpu));\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/stubs/instrument.c b/stubs/instrument.c\nindex 658a872e1c..ea8df6d467 100644\n--- a/stubs/instrument.c\n+++ b/stubs/instrument.c\n@@ -12,3 +12,4 @@\n \n __thread InstrState instr_cur_state;\n void (*instr_event__guest_cpu_enter)(QICPU *vcpu);\n+void (*instr_event__guest_cpu_exit)(QICPU *vcpu);\ndiff --git a/trace/control.c b/trace/control.c\nindex 82d8989c4d..946a0af818 100644\n--- a/trace/control.c\n+++ b/trace/control.c\n@@ -1,13 +1,14 @@\n /*\n  * Interface for configuring and controlling the state of tracing events.\n  *\n- * Copyright (C) 2011-2016 Lluís Vilanova <vilanova@ac.upc.edu>\n+ * Copyright (C) 2011-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 \"instrument/events.h\"\n #include \"trace/control.h\"\n #include \"qemu/help_option.h\"\n #ifdef CONFIG_TRACE_SIMPLE\n@@ -272,6 +273,7 @@ void trace_fini_vcpu(CPUState *vcpu)\n     TraceEventIter iter;\n     TraceEvent *ev;\n \n+    instr_guest_cpu_exit(vcpu);\n     trace_guest_cpu_exit(vcpu);\n \n     trace_event_iter_init(&iter, NULL);\n",
    "prefixes": [
        "v4",
        "13/20"
    ]
}