get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2225932,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2225932/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421202110.306051-14-peterx@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260421202110.306051-14-peterx@redhat.com>",
    "list_archive_url": null,
    "date": "2026-04-21T20:21:07",
    "name": "[v2,13/16] migration: Remember total dirty bytes in mig_stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7cde98916a4233c6e14df698cf05e1c54a64febf",
    "submitter": {
        "id": 67717,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/67717/?format=api",
        "name": "Peter Xu",
        "email": "peterx@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421202110.306051-14-peterx@redhat.com/mbox/",
    "series": [
        {
            "id": 500889,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500889/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500889",
            "date": "2026-04-21T20:20:55",
            "name": "migration/vfio: Fix a few issues on API misuse or statistic reports",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/500889/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2225932/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2225932/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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=XDXX8K8W;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=Mbl90EQb;\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=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.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 4g0Ygb2J1Dz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 06:22:35 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFHbJ-000112-MM; Tue, 21 Apr 2026 16:21:41 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1wFHbH-00010q-LB\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 16:21:39 -0400",
            "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <peterx@redhat.com>) id 1wFHbF-0008Sv-St\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 16:21:39 -0400",
            "from mail-qv1-f69.google.com (mail-qv1-f69.google.com\n [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-633-uvcKwInBO4OJaqQGzsai3A-1; Tue, 21 Apr 2026 16:21:35 -0400",
            "by mail-qv1-f69.google.com with SMTP id\n 6a1803df08f44-8acdd800537so96006106d6.1\n for <qemu-devel@nongnu.org>; Tue, 21 Apr 2026 13:21:35 -0700 (PDT)",
            "from x1.local ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8b02ae5c26csm114343556d6.31.2026.04.21.13.21.32\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Apr 2026 13:21:33 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776802897;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=Af9JljxWi70ez3woHKeuds1zCU/ND/L9uxolesYJp+k=;\n b=XDXX8K8WY4l2YW45wcL2weFVrtwGBM9bXI+Mm85ZJRebOtmf4PQwqE20gi/oBbpSj2mHho\n xjGi4+Rlb+PDOphK5ITpwrZHS+1DK9HhOqOw3Il3xYqwwk7OBz8fLUEq+GinGZEeQz1MoF\n QAnqz35EQ/zFdzqd1ap+XukdbNujym4=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1776802895; x=1777407695; 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=Af9JljxWi70ez3woHKeuds1zCU/ND/L9uxolesYJp+k=;\n b=Mbl90EQbQ00AU1rBmNPUn0xB2phP3VT1xj3CYHPpzUsUwK9q4teBzeCbd/ayjMgfqv\n ToWETRo8ozQL8z5Z1MKKXDrTozz54iqp3c0JeuRAEOI2/Yw8Tk4lberFcD3+I02tnWN3\n E8CXn5s7bhBSCu4T2+5sTMDdut5Ren5CvUKEGRKK7q5K1LMXTS/9ifL/uYwbCxuX1Qn9\n 9J6NwLZTm3U/1VLdZdRQaA5nUdt/8erUCAky+RUVazglmJYwNa4Ezg114BrpA4KPOWYX\n 5WIadpnz13CarzJZuIeuFLfS1YNaCcwFid6piNbJslP0iZ/OKzMNbTp7y+5+z4TwhXJR\n jimg=="
        ],
        "X-MC-Unique": "uvcKwInBO4OJaqQGzsai3A-1",
        "X-Mimecast-MFC-AGG-ID": "uvcKwInBO4OJaqQGzsai3A_1776802895",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776802895; x=1777407695;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=Af9JljxWi70ez3woHKeuds1zCU/ND/L9uxolesYJp+k=;\n b=EeVQINiu36gVZbvvG9jKjd2UuLgxDc8wLKOC1RnznmiUfCobLX1tAZD3i/hGHKCBFj\n h8bYMjnlzXFcDEXm43QU+9RRH6V4wlH/oa4gG9+X2BgozXlPKp7rI9+J109HleiHWJNr\n qAHau9a0K0xfh7MGk/VQsMXGyF+gqfo4NDPbb5ewehdlcfbJ6UIDB5kvvwQfFTCUP01I\n jp1xzUtD1hQQ7iA/xwDet2DCrmrpMWvcQBI+OlfXnnI5myq+DItkK4FCb2pKOUTNgda+\n +600TWLnzAg7qhUbo9fiCcHF8oHMz+PzffSVPGWjzSW/2Cuxmr/hsD4mVgG1hbdj5UMT\n U6sw==",
        "X-Gm-Message-State": "AOJu0YwKdhjSN0iP9MzNhZBW6mh1voGwxN0tgnu1+q9mi5KtcCNVF2WB\n GC2UOAhy0RlAJLT2RFQMtyvbHGKq8lCdqBM6Y6DRYe+7zOw+IX2dXopN32QrIjiSz/rG6ZdEXIn\n XsHpDDMbsMJlkrIHutwx9QLiWPLNEpoZQ2ExUOA9UDlMmbjsDDcLJKt0PjeV/XXccyDi2FLpgrt\n 2VpcMeKctKWerJPneiNkXTgf0HIoum1snLPobP4A==",
        "X-Gm-Gg": "AeBDieuF0Kgz+DLeoMkfcMOBSJ7o9qYfDSWfwZIRLWhlucZeFhgj2tJ+Hl5XOuWHIF5\n p5OGTQZ3q2GUyMY+1oDjhjCuVutl71nrX7U3Vz+p7GoOO+arqSnCOx6TxostDY4EJ/j+wuUMXKe\n p7CkKllTsiaNoWPLgQFj/WdIiX7SCFhcabcuhDfZR0iUn49T7c9k4N+zjxc2zI8TaEimx3eR0Sl\n NmqpgJSvzClcTLiq+bDpiZk039u9onv76OClfa1e23LYmF6FwuRBt1Tyqf5e9DRiEjtxM0+FzpO\n EzXx/A2HgMW1Rew/eD+DPgbSYgkg1+WaMjYvQtIbkg/vEMvCygNZ86L9fOQ02itW+IzNkxnynv7\n VwJBT/y9zCV7y9wu0wAvOhSUdSM4j99hbiutJvqTtLHxOqp23l593dTP5WA==",
        "X-Received": [
            "by 2002:a05:6214:21e6:b0:8a1:88f7:d292 with SMTP id\n 6a1803df08f44-8b0280135dbmr332386396d6.13.1776802894725;\n Tue, 21 Apr 2026 13:21:34 -0700 (PDT)",
            "by 2002:a05:6214:21e6:b0:8a1:88f7:d292 with SMTP id\n 6a1803df08f44-8b0280135dbmr332385816d6.13.1776802894193;\n Tue, 21 Apr 2026 13:21:34 -0700 (PDT)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Joao Martins <joao.m.martins@oracle.com>,\n Markus Armbruster <armbru@redhat.com>,\n =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>,\n Avihai Horon <avihaih@nvidia.com>,\n =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n Fabiano Rosas <farosas@suse.de>, Prasad Pandit <ppandit@redhat.com>,\n Alex Williamson <alex@shazbot.org>, Kirti Wankhede <kwankhede@nvidia.com>,\n Zhiyi Guo <zhguo@redhat.com>, Peter Xu <peterx@redhat.com>,\n \"Maciej S . Szmigiero\" <mail@maciej.szmigiero.name>,\n Juraj Marcin <jmarcin@redhat.com>",
        "Subject": "[PATCH v2 13/16] migration: Remember total dirty bytes in mig_stats",
        "Date": "Tue, 21 Apr 2026 16:21:07 -0400",
        "Message-ID": "<20260421202110.306051-14-peterx@redhat.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260421202110.306051-1-peterx@redhat.com>",
        "References": "<20260421202110.306051-1-peterx@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com;\n helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001, 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 development <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": "Introduce this new counter to remember the total dirty bytes for the whole\nsystem.  It will be used for query-migrate command to fetch system-wise\nremaining data.\n\nA prior attempt was made to not use this counter but query directly from\nall the modules in a QMP handler, but it exposed some complexity not only\non migration state machine race conditions (where the query may be invoked\nanytime of the state machine), or on locking implications (where some of\nthe query hooks may take BQL, which is illegal at least in a QMP handler).\nFor more information, see:\n\nhttps://lore.kernel.org/r/aeZMtxqrKWAMKzdN@x1.local\n\nThis oneliner will resolve everything, except that it is not as accurate.\nThe hope is it is a worthwhile trade-off solution, after knowing above\nchallenges.\n\nNow, there is one more reason we should make each invocation of\nsave_live_iterate() to be lightweight, because this counter will only get\nupdated once for each loop over all save_live_iterate() hooks when present.\nBut that's always the goal.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n migration/migration-stats.h | 7 +++++++\n migration/savevm.c          | 7 +++++++\n 2 files changed, 14 insertions(+)",
    "diff": "diff --git a/migration/migration-stats.h b/migration/migration-stats.h\nindex 1775b916df..9f9a8eb9eb 100644\n--- a/migration/migration-stats.h\n+++ b/migration/migration-stats.h\n@@ -36,6 +36,13 @@ typedef struct {\n      * best-effort estimation on expected downtime.\n      */\n     uint64_t dirty_bytes_last_sync;\n+    /*\n+     * Number of bytes that were reported dirty now.  This is an estimate\n+     * value and will be updated every time migration thread queries from\n+     * modules in an iteration loop.  It is used to provide best-effort\n+     * estimation on total remaining data.\n+     */\n+    uint64_t dirty_bytes_total;\n     /*\n      * Number of pages dirtied per second.\n      */\ndiff --git a/migration/savevm.c b/migration/savevm.c\nindex d221e2961b..b49a80f574 100644\n--- a/migration/savevm.c\n+++ b/migration/savevm.c\n@@ -1781,6 +1781,13 @@ void qemu_savevm_query_pending(MigPendingData *pending, bool exact)\n     pending->total_bytes = pending->precopy_bytes +\n         pending->stopcopy_bytes + pending->postcopy_bytes;\n \n+    /*\n+     * Update system remaining dirty bytes whenever QEMU queries.  It will\n+     * make the value to be not as accurate, but should still be pretty\n+     * close to reality when this got invoked frequently while iterating.\n+     */\n+    mig_stats.dirty_bytes_total = pending->total_bytes;\n+\n     trace_qemu_savevm_query_pending(exact, pending->precopy_bytes,\n                                     pending->stopcopy_bytes,\n                                     pending->postcopy_bytes,\n",
    "prefixes": [
        "v2",
        "13/16"
    ]
}