get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2026289,
    "url": "http://patchwork.ozlabs.org/api/patches/2026289/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20241220104220.2007786-12-npiggin@gmail.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": "<20241220104220.2007786-12-npiggin@gmail.com>",
    "list_archive_url": null,
    "date": "2024-12-20T10:42:13",
    "name": "[11/17] block: Convert to new bh API",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "ff012dbe7c6381a7f32f79f9bedff460f91d52b2",
    "submitter": {
        "id": 69518,
        "url": "http://patchwork.ozlabs.org/api/people/69518/?format=api",
        "name": "Nicholas Piggin",
        "email": "npiggin@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20241220104220.2007786-12-npiggin@gmail.com/mbox/",
    "series": [
        {
            "id": 437728,
            "url": "http://patchwork.ozlabs.org/api/series/437728/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=437728",
            "date": "2024-12-20T10:42:02",
            "name": "replay: Fixes and avocado test updates",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/437728/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2026289/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2026289/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@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=XYPrpGPU;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4YF3vB0jSPz1yT2\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Dec 2024 21:44:21 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1tOaUO-0006YP-Sj; Fri, 20 Dec 2024 05:44:12 -0500",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <npiggin@gmail.com>)\n id 1tOaUG-0006LZ-4T; Fri, 20 Dec 2024 05:44:05 -0500",
            "from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <npiggin@gmail.com>)\n id 1tOaUD-0005Ps-OO; Fri, 20 Dec 2024 05:44:03 -0500",
            "by mail-pg1-x530.google.com with SMTP id\n 41be03b00d2f7-7fd17f2312bso1311894a12.0;\n Fri, 20 Dec 2024 02:44:00 -0800 (PST)",
            "from wheely.local0.net (14-200-18-130.tpgi.com.au. [14.200.18.130])\n by smtp.gmail.com with ESMTPSA id\n 98e67ed59e1d1-2f2ee06dfd3sm5376942a91.32.2024.12.20.02.43.51\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 20 Dec 2024 02:43:58 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1734691439; x=1735296239; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Ov1yKiOsdPvfFrptmu7MR0EFv3xHuopr7cPf6vnnWy4=;\n b=XYPrpGPUyyYURBoU8tDhf/cCaVy4vDaEV50QJnhYCW3QuBt4zqpYkaYBlXE8ELsbX6\n 2SlLWFFhpwOB/tc/eZ9ZPFFTIZB20d7mC0LeggmNqZR/ZTR+/l5mhiXf7L3U2RmK6ir7\n YRn3mjhTbnabjbBf9sg0SUwwHrsTJqlF171WHwBwANi/4S7/LHtQt+WHYEXQU2V8GqKw\n TMUnRyPcTYvK52EVaea9rp07OIFHmfbTXJSECzT2wn/hFoKFA7GnA14hrSPpBerVuSV1\n Wr3HE5simThAC5EadVw+/n8O0meAR3GBGnRDVOupRANeDlniPCOEJiBk3xnHgtyE9dyd\n Zsow==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1734691439; x=1735296239;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=Ov1yKiOsdPvfFrptmu7MR0EFv3xHuopr7cPf6vnnWy4=;\n b=R8Yv/Uw9VYMPH5/Ct8xW3lY+Mz9Omnc7QQfYP8FLteTS/41Mv4tCF7HmtjIyN6jSqh\n Cr9mYXWtjufqlgRb6duTgFbrdu4SNETgPKPT1qUNsxooOah68SgEm0eHAdoNs3I3+W5K\n 9Tkl/r5BDwumKLqe/8KSTjBQHIrfHyQexbSoV4VxQr3uEwLcmgYDNcz+/MA8htAV3V/G\n 0iFxRwoWpT1cNvD2pKpSzHW0sKzbLmTLbNpG7FZsQf8cEYEl7lH7HmZYTw9JLtF+ofWq\n uro2q2L1Q9dJTzQwvyz0U1G2sQ5At1gXqZxdO2blboG16Xv38CZYoo2Bw07cxJPCd0Re\n qNKA==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCUVli86TQNnkMOZfd6ZC53C2E8k0zcchQKBfTH0sP/XEI9p+I6LYhtGA1LQy9fFZxYrQfNyZjzkzqSl@nongnu.org",
        "X-Gm-Message-State": "AOJu0Yz4Y4kgjUWakMs/mROjUAyTRj2lI5fG/uh+rjrKLiCDn9E5gBQe\n N7YtRGkOJTmOVPHeHPQGNfP6zRGTILRcA5P/rOjfB+DPruSD/C9BcocHVw==",
        "X-Gm-Gg": "ASbGncvmPiqD5vUCbdsXVnV0IWsHK4gZeudsaQDA5cio+3UP+3A6U0tYmKibiS5j2dm\n 4C3F3r1xz5pV/QsGMVWF38qkibwBleENbz98wRQtM87nzCa7FmnmuJHN9eSvKrAeUGa97DG31Bt\n DAewRHRcsLNJtMaMlWnd7W4dsim5OvynC//anfOYt+l3qfo9vjgTR2bGkze4EeLV0KvrdFelEaM\n Iwyn/nntPRf/90UOBwW1tUnREyREcvLvdz5X2N7aX4LfpoVmAS+0w93TbrJFvrXcd55CiAIs8Vf\n B0cyhJcl0Q==",
        "X-Google-Smtp-Source": "\n AGHT+IFvRyMq8CdIVQg0yGz2vSHPh1Q6JBHCFzvh0AcDChmEcYMn2r5HtpVkz+aKO0r/TzoPfaqpOw==",
        "X-Received": "by 2002:a17:90b:3cc6:b0:2ee:aa95:6de9 with SMTP id\n 98e67ed59e1d1-2f452eed7e1mr3872323a91.33.1734691439408;\n Fri, 20 Dec 2024 02:43:59 -0800 (PST)",
        "From": "Nicholas Piggin <npiggin@gmail.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Nicholas Piggin <npiggin@gmail.com>, qemu-block@nongnu.org, =?utf-8?q?Al?=\n\t=?utf-8?q?ex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,\n Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>,\n Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>,\n Fam Zheng <fam@euphon.net>, Ronnie Sahlberg <ronniesahlberg@gmail.com>,\n John Snow <jsnow@redhat.com>, \"Michael S. Tsirkin\" <mst@redhat.com>,\n Jason Wang <jasowang@redhat.com>,\n Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,\n Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,\n \"Dr. David Alan Gilbert\" <dave@treblig.org>,\n Markus Armbruster <armbru@redhat.com>, Michael Roth <michael.roth@amd.com>,\n Wainer dos Santos Moschetta <wainersm@redhat.com>",
        "Subject": "[PATCH 11/17] block: Convert to new bh API",
        "Date": "Fri, 20 Dec 2024 20:42:13 +1000",
        "Message-ID": "<20241220104220.2007786-12-npiggin@gmail.com>",
        "X-Mailer": "git-send-email 2.45.2",
        "In-Reply-To": "<20241220104220.2007786-1-npiggin@gmail.com>",
        "References": "<20241220104220.2007786-1-npiggin@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::530;\n envelope-from=npiggin@gmail.com; helo=mail-pg1-x530.google.com",
        "X-Spam_score_int": "-20",
        "X-Spam_score": "-2.1",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Convert qemu_bh_schedule() to qemu_bh_schedule_event() and\naio_bh_schedule_oneshot() to aio_bh_schedule_oneshot_event(), which can\nspecify the clock type, making it compatible with record-replay.\n\nunreferencing a bdrv does not affect target machine state, so it should\nuse QEMU_CLOCK_REALTIME so it is not recorded and replayed. blkreplay\nhas cases at startup where the device is used before the event code is\nset up, so it needs special handling to avoid creating bh replay events.\n\nSigned-off-by: Nicholas Piggin <npiggin@gmail.com>\n---\n include/block/aio.h    |  9 +++++++++\n block.c                |  4 +++-\n block/blkreplay.c      | 10 +++++++++-\n replay/replay-events.c |  7 ++-----\n util/async.c           |  5 +++++\n 5 files changed, 28 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/include/block/aio.h b/include/block/aio.h\nindex bc323b0d936..26859bd0b93 100644\n--- a/include/block/aio.h\n+++ b/include/block/aio.h\n@@ -405,6 +405,15 @@ int aio_bh_poll(AioContext *ctx);\n  */\n void qemu_bh_schedule_event(QEMUBH *bh, QEMUClockType clock_type);\n \n+/**\n+ * qemu_bh_schedule_event_noreplay: Schedule a bottom half avoiding replay.\n+ *\n+ * This function is not to be used outside record-replay code.\n+ *\n+ * @bh: The bottom half to be scheduled.\n+ */\n+void qemu_bh_schedule_event_noreplay(QEMUBH *bh);\n+\n /**\n  * qemu_bh_schedule: Schedule a bottom half.\n  *\ndiff --git a/block.c b/block.c\nindex 7d90007cae8..77e6c6b3c7e 100644\n--- a/block.c\n+++ b/block.c\n@@ -7144,7 +7144,9 @@ void bdrv_schedule_unref(BlockDriverState *bs)\n     if (!bs) {\n         return;\n     }\n-    aio_bh_schedule_oneshot(qemu_get_aio_context(), bdrv_schedule_unref_bh, bs);\n+    aio_bh_schedule_oneshot_event(qemu_get_aio_context(),\n+                                  bdrv_schedule_unref_bh, bs,\n+                                  QEMU_CLOCK_REALTIME);\n }\n \n struct BdrvOpBlocker {\ndiff --git a/block/blkreplay.c b/block/blkreplay.c\nindex 792d980aa9d..c6b9d91062e 100644\n--- a/block/blkreplay.c\n+++ b/block/blkreplay.c\n@@ -67,7 +67,15 @@ static void block_request_create(uint64_t reqid, BlockDriverState *bs,\n         .co = co,\n         .bh = aio_bh_new(bdrv_get_aio_context(bs), blkreplay_bh_cb, req),\n     };\n-    replay_block_event(req->bh, reqid);\n+    if (replay_events_enabled()) {\n+        replay_block_event(req->bh, reqid);\n+    } else {\n+        /*\n+         * block can be used before replay is initialized. Work around\n+         * that here.\n+         */\n+        qemu_bh_schedule_event_noreplay(req->bh);\n+    }\n }\n \n static int coroutine_fn GRAPH_RDLOCK\ndiff --git a/replay/replay-events.c b/replay/replay-events.c\nindex d4b095b2097..6a7c27cac1e 100644\n--- a/replay/replay-events.c\n+++ b/replay/replay-events.c\n@@ -154,11 +154,8 @@ void replay_add_input_sync_event(void)\n \n void replay_block_event(QEMUBH *bh, uint64_t id)\n {\n-    if (events_enabled) {\n-        replay_add_event(REPLAY_ASYNC_EVENT_BLOCK, bh, NULL, id);\n-    } else {\n-        qemu_bh_schedule(bh);\n-    }\n+    g_assert(events_enabled);\n+    replay_add_event(REPLAY_ASYNC_EVENT_BLOCK, bh, NULL, id);\n }\n \n static void replay_save_event(Event *event)\ndiff --git a/util/async.c b/util/async.c\nindex 6ac994effec..5d2c76dec08 100644\n--- a/util/async.c\n+++ b/util/async.c\n@@ -261,6 +261,11 @@ void qemu_bh_schedule_event(QEMUBH *bh, QEMUClockType clock_type)\n     }\n }\n \n+void qemu_bh_schedule_event_noreplay(QEMUBH *bh)\n+{\n+    aio_bh_enqueue(bh, BH_SCHEDULED);\n+}\n+\n void qemu_bh_schedule_idle(QEMUBH *bh)\n {\n     aio_bh_enqueue(bh, BH_SCHEDULED | BH_IDLE);\n",
    "prefixes": [
        "11/17"
    ]
}