get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2219988,
    "url": "http://patchwork.ozlabs.org/api/patches/2219988/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260405152612.93027-3-viking4@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": "<20260405152612.93027-3-viking4@gmail.com>",
    "list_archive_url": null,
    "date": "2026-04-05T15:26:08",
    "name": "[2/2] migration: expose RAM stats and timing on destination via query-migrate",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f91565ffa59db9263293d136158829e94769025b",
    "submitter": {
        "id": 92831,
        "url": "http://patchwork.ozlabs.org/api/people/92831/?format=api",
        "name": "Trieu Huynh",
        "email": "vikingtc4@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260405152612.93027-3-viking4@gmail.com/mbox/",
    "series": [
        {
            "id": 498790,
            "url": "http://patchwork.ozlabs.org/api/series/498790/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=498790",
            "date": "2026-04-05T15:26:06",
            "name": "migration: include timing and RAM stats on destination when query-migrate",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498790/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2219988/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2219988/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=20251104 header.b=NbE8dZps;\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 4fpbtb5qcBz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 06 Apr 2026 01:27:35 +1000 (AEST)",
            "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 1w9PN5-0006ni-3K; Sun, 05 Apr 2026 11:26:43 -0400",
            "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 <vikingtc4@gmail.com>)\n id 1w9PN3-0006nP-Ha\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 11:26:41 -0400",
            "from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <vikingtc4@gmail.com>)\n id 1w9PN1-0008S9-OG\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 11:26:41 -0400",
            "by mail-pf1-x42b.google.com with SMTP id\n d2e1a72fcca58-82cf976ecacso1275050b3a.1\n for <qemu-devel@nongnu.org>; Sun, 05 Apr 2026 08:26:39 -0700 (PDT)",
            "from localhost.localdomain ([123.19.199.205])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82cf9c72967sm11187938b3a.49.2026.04.05.08.26.35\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 05 Apr 2026 08:26:37 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775402798; x=1776007598; 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=Y1GcBsKVAD50cVidc+/vzB6+ClCQQmkI2qkFkMTszqY=;\n b=NbE8dZpsK1vjMNTAz7dfdIm7F/wNBgHcpPgmtddchVKJM5lH5aUOq5JsXr2gkxDbyW\n rZvE4QLKr6CZqFPcSeCQJwSQHQJmENMtn+mBaQEFKUnYkloR6W+/PI6RzA/t1zdB813D\n WNuZGyiVELZ/m4phHTGP3GbqqXVv7o10ULA3aQkTqc87lKtPwn+X+uXBjCY5twJ1BqPF\n EiHU6buvQJPXt1dE4fdq1ffXoG8lt59y/wp9c+kVJD/5WNWyetkdiFYaFGbSV4/JWFe7\n w7oU8iOOEJfWeNyLE2Ikf4DBMYSzwN1cKPpljtNLmp+ihatSkGnenNM2U6MVVfPnYcVQ\n dADQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775402798; x=1776007598;\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=Y1GcBsKVAD50cVidc+/vzB6+ClCQQmkI2qkFkMTszqY=;\n b=alio23m5sZQoTiFzhKtPsT5nCXu7hZyL5WfFa+VzRAmPb/TyNJFg6aueBR188iDJPL\n vkLE3lffEGg/v+u6cxHyo77kKyjl1A2xmIIQcQO/9y3y5nstK1LpGo7ag1tyOUDVqFsE\n 7T61PXNvGROAUBMeKfnRPQ7k8qKlzulrsxttSwSccjElVI0uwEYhbf9106nUOnvZhiqg\n 0cIbN+VnLpSWivI0/S32ShrTt89S0EtX8r8P/U84djTaqepvrn/qAeZ9AsyCf+NZG4v2\n KvABr/F1Of0ltbZOR51ggIhv8+fM1ax+Ze88ujTxZaa07lCU8ZA/w5qW3EWQyGxdX5VN\n qQ0g==",
        "X-Gm-Message-State": "AOJu0YyAZIqxxNz/g783Me1U3zMh/fS01Yz7aTdTNFV6PGYusc+cXJ9T\n kT2Ohes0C2UaJqeD2gFYqSKjCZC7kD4tsfdZM+3XZCOf12cqrTqM7PMkkxu19Z42elg=",
        "X-Gm-Gg": "AeBDiesLAOrIqqRDalj2Gez8mxlQpMQZbQIU0F474Duj6LL3U3iPzdl0+/HlpN0Nkz0\n YypDGwlPybC585NPgt2y2vUm9vt8DG8rPoXpNfp3C57SAscXRZ93hmBXhPdyIHHrpOipm+qjBdN\n Q3q4zVo38nmyOqGYi81RwzkBZoNm5pnCYv1aex6p4RdbBUKw1I3Tw2XMBwZG/fmd7g5i5GPezer\n S8svwTosIh1ljo8gbxJXs+srqBaskbPcSOYCZ78O9o2fFQFADzHk25b54QT7AqcqawflgQn4ZQP\n JEQbhbOymnyeULO24YZAKvo6lS68FO8hpkjpbgiRJgqvkUBTVKEy3iJxQ1bJHVjXl148bt8RDRL\n 3L5jer1rInn7xkxzWG6rbGObbIcaxAfpTEywsOPqisWgzw06x7YkfWkkLSMI9v4A+ZYZ8WQDR6u\n nAowm+Kb9O/XvAJDFkg/1ub1YqKMCmxIaKtkLPrcVWDsUY3zsAtWLK8CWcbQ==",
        "X-Received": "by 2002:a05:6a00:3499:b0:829:8041:83f with SMTP id\n d2e1a72fcca58-82d0da2e724mr8742921b3a.7.1775402798051;\n Sun, 05 Apr 2026 08:26:38 -0700 (PDT)",
        "From": "Trieu Huynh <vikingtc4@gmail.com>",
        "X-Google-Original-From": "Trieu Huynh <viking4@gmail.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Trieu Huynh <vikingtc4@gmail.com>, Peter Xu <peterx@redhat.com>,\n Fabiano Rosas <farosas@suse.de>, Eric Blake <eblake@redhat.com>,\n Markus Armbruster <armbru@redhat.com>",
        "Subject": "[PATCH 2/2] migration: expose RAM stats and timing on destination via\n query-migrate",
        "Date": "Sun,  5 Apr 2026 22:26:08 +0700",
        "Message-ID": "<20260405152612.93027-3-viking4@gmail.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260405152612.93027-1-viking4@gmail.com>",
        "References": "<20260405152612.93027-1-viking4@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::42b;\n envelope-from=vikingtc4@gmail.com; helo=mail-pf1-x42b.google.com",
        "X-Spam_score_int": "-17",
        "X-Spam_score": "-1.8",
        "X-Spam_bar": "-",
        "X-Spam_report": "(-1.8 / 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,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, 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 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": "From: Trieu Huynh <vikingtc4@gmail.com>\n\nMigrationStats had all-required QAPI fields, so partially populating\ninfo->ram on the destination would force display of source-only metrics\n(dirty-sync-count, precopy-bytes, etc.) as misleading zeros.\n\nMake those source-only fields optional with '*' in the QAPI schema.\nUpdate populate_ram_info() to set them via has_* setters so source\noutput is unchanged.\n\nAs per schema's changes, fill_destination_migration_info() can now\npopulate info->ram for the COMPLETED case with the fields that are\nmeaningful on the receive side:\n\n  * total, remaining, page-size         (RAM layout)\n  * transferred, normal, normal-bytes   (bytes/pages received)\n  * duplicate                           (zero pages received)\n  * mbps                                (throughput: transferred*8\n                                         /time_ms/1000)\n  * pages-per-second                    (total pages / duration in\n                                         seconds)\n\nOthers optional fields (dirty-sync-count, precopy-bytes,\ndowntime-bytes, postcopy-bytes, multifd-bytes, postcopy-requests,\ndirty-sync-missed-zero-copy, dirty-pages-rate) are left unset and\nare absent from the destination output.\n\nOn dst, {\"execute\":\"query-migrate\"}\n* As-is:\n{\n    \"return\": {\n        \"status\": \"completed\"\n}\n* To-be:\n{\n    \"return\": {\n        \"status\": \"completed\",\n        \"total-time\": 94,\n        \"ram\": {\n            \"total\": 554508288,\n            \"pages-per-second\": 1440234,\n            \"page-size\": 4096,\n            \"remaining\": 0,\n            \"mbps\": 97.955404255319152,\n            \"transferred\": 1150976,\n            \"duplicate\": 135101,\n            \"normal-bytes\": 1150976,\n            \"normal\": 281\n        }\n    }\n}\n\nSigned-off-by: Trieu Huynh <vikingtc4@gmail.com>\n---\n migration/migration.c | 35 +++++++++++++++++++++++++++++++++++\n qapi/migration.json   | 14 +++++++-------\n 2 files changed, 42 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/migration/migration.c b/migration/migration.c\nindex 17c9a8b344..925d29890d 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -1063,17 +1063,24 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)\n     info->ram->normal = qatomic_read(&mig_stats.normal_pages);\n     info->ram->normal_bytes = info->ram->normal * page_size;\n     info->ram->mbps = s->mbps;\n+    info->ram->has_dirty_sync_count = true;\n     info->ram->dirty_sync_count =\n         qatomic_read(&mig_stats.dirty_sync_count);\n+    info->ram->has_dirty_sync_missed_zero_copy = true;\n     info->ram->dirty_sync_missed_zero_copy =\n         qatomic_read(&mig_stats.dirty_sync_missed_zero_copy);\n+    info->ram->has_postcopy_requests = true;\n     info->ram->postcopy_requests =\n         qatomic_read(&mig_stats.postcopy_requests);\n     info->ram->page_size = page_size;\n+    info->ram->has_multifd_bytes = true;\n     info->ram->multifd_bytes = qatomic_read(&mig_stats.multifd_bytes);\n     info->ram->pages_per_second = s->pages_per_second;\n+    info->ram->has_precopy_bytes = true;\n     info->ram->precopy_bytes = qatomic_read(&mig_stats.precopy_bytes);\n+    info->ram->has_downtime_bytes = true;\n     info->ram->downtime_bytes = qatomic_read(&mig_stats.downtime_bytes);\n+    info->ram->has_postcopy_bytes = true;\n     info->ram->postcopy_bytes = qatomic_read(&mig_stats.postcopy_bytes);\n \n     if (migrate_xbzrle()) {\n@@ -1094,6 +1101,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s)\n \n     if (s->state != MIGRATION_STATUS_COMPLETED) {\n         info->ram->remaining = ram_bytes_remaining();\n+        info->ram->has_dirty_pages_rate = true;\n         info->ram->dirty_pages_rate =\n            qatomic_read(&mig_stats.dirty_pages_rate);\n     }\n@@ -1209,6 +1217,33 @@ static void fill_destination_migration_info(MigrationInfo *info)\n     case MIGRATION_STATUS_COMPLETED:\n         info->has_status = true;\n         fill_destination_postcopy_migration_info(info);\n+        if (mis->total_time > 0) {\n+            info->has_total_time = true;\n+            info->total_time = mis->total_time;\n+        }\n+        {\n+            size_t page_size = qemu_target_page_size();\n+            uint64_t normal  = mis->received_normal_pages;\n+            uint64_t zero    = mis->received_zero_pages;\n+            uint64_t xbzrle  = mis->received_xbzrle_pages;\n+\n+            info->ram = g_malloc0(sizeof(*info->ram));\n+            info->ram->total        = ram_bytes_total();\n+            info->ram->remaining    = 0;\n+            info->ram->normal       = normal + xbzrle;\n+            info->ram->normal_bytes = (normal + xbzrle) * page_size;\n+            info->ram->duplicate    = zero;\n+            info->ram->transferred  = (normal + xbzrle) * page_size;\n+            info->ram->page_size    = page_size;\n+\n+            if (info->has_total_time) {\n+                info->ram->mbps = info->ram->transferred * 8.0\n+                                  / info->total_time / 1000.0;\n+                info->ram->pages_per_second = (normal + xbzrle + zero)\n+                                              * 1000.0 / info->total_time;\n+            }\n+            /* source-only optional omitted from output */\n+        }\n         break;\n     default:\n         return;\ndiff --git a/qapi/migration.json b/qapi/migration.json\nindex 7134d4ce47..a695d04a22 100644\n--- a/qapi/migration.json\n+++ b/qapi/migration.json\n@@ -68,13 +68,13 @@\n   'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,\n            'duplicate': 'int',\n            'normal': 'int',\n-           'normal-bytes': 'int', 'dirty-pages-rate': 'int',\n-           'mbps': 'number', 'dirty-sync-count': 'int',\n-           'postcopy-requests': 'int', 'page-size': 'int',\n-           'multifd-bytes': 'uint64', 'pages-per-second': 'uint64',\n-           'precopy-bytes': 'uint64', 'downtime-bytes': 'uint64',\n-           'postcopy-bytes': 'uint64',\n-           'dirty-sync-missed-zero-copy': 'uint64' } }\n+           'normal-bytes': 'int', '*dirty-pages-rate': 'int',\n+           'mbps': 'number', '*dirty-sync-count': 'int',\n+           '*postcopy-requests': 'int', 'page-size': 'int',\n+           '*multifd-bytes': 'uint64', 'pages-per-second': 'uint64',\n+           '*precopy-bytes': 'uint64', '*downtime-bytes': 'uint64',\n+           '*postcopy-bytes': 'uint64',\n+           '*dirty-sync-missed-zero-copy': 'uint64' } }\n \n ##\n # @XBZRLECacheStats:\n",
    "prefixes": [
        "2/2"
    ]
}