get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2221126,
    "url": "http://patchwork.ozlabs.org/api/1.0/patches/2221126/?format=api",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.0/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": ""
    },
    "msgid": "<20260408165559.157108-13-peterx@redhat.com>",
    "date": "2026-04-08T16:55:56",
    "name": "[12/14] migration: Fix calculation of expected_downtime to take VFIO info",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "79413f9b5e94c1914eb226af65f74d8a5bef1546",
    "submitter": {
        "id": 67717,
        "url": "http://patchwork.ozlabs.org/api/1.0/people/67717/?format=api",
        "name": "Peter Xu",
        "email": "peterx@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260408165559.157108-13-peterx@redhat.com/mbox/",
    "series": [
        {
            "id": 499176,
            "url": "http://patchwork.ozlabs.org/api/1.0/series/499176/?format=api",
            "date": "2026-04-08T16:55:55",
            "name": "migration/vfio: Fix a few issues on API misuse or statistic reports",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499176/mbox/"
        }
    ],
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221126/checks/",
    "tags": {},
    "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=W8wjzC1t;\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=Q3fryF58;\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 (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 4frXwr0fWMz1yD6\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 05:21:16 +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 1wAYJz-0001L4-SX; Wed, 08 Apr 2026 15:12:16 -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 1wAYHL-0005lA-Kq\n for qemu-devel@nongnu.org; Wed, 08 Apr 2026 15:09:31 -0400",
            "from us-smtp-delivery-124.mimecast.com ([170.10.133.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 1wAWCU-00029W-An\n for qemu-devel@nongnu.org; Wed, 08 Apr 2026 12:56:23 -0400",
            "from mail-qt1-f199.google.com (mail-qt1-f199.google.com\n [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-522-TrcK_ewpO_mM-uwv1n1J7g-1; Wed, 08 Apr 2026 12:56:20 -0400",
            "by mail-qt1-f199.google.com with SMTP id\n d75a77b69052e-50d812c898cso3469351cf.1\n for <qemu-devel@nongnu.org>; Wed, 08 Apr 2026 09:56:20 -0700 (PDT)",
            "from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n d75a77b69052e-50d712c2617sm130491901cf.31.2026.04.08.09.56.18\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 08 Apr 2026 09:56:18 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775667382;\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=y3AUfIp5hhwSuzshcuDyBJj3UN6iMbkU2aTwINm6YxQ=;\n b=W8wjzC1tFbNZnUWzEGHWZ2sjc8Zk4RS+os+5pErowD+WSAtH2S8M/2hf8YegUh35wLueM+\n Ih0cFpDN0gkzdAyIZA9ippmYGpGonCYj7fxUZ4oAtDpZ5Z4Ek/4byQixnnn787PMGLnwje\n RTcRBTvcqCj/LWMNraitsu+hoQeypiY=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1775667380; x=1776272180; 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=y3AUfIp5hhwSuzshcuDyBJj3UN6iMbkU2aTwINm6YxQ=;\n b=Q3fryF58KvtwuXxYSulS37QYyiJzGUWz92WgEHqe/Wl9gp2MPyWAQ3xf4T6mUjf5ie\n ypXPLgM4ModjThEqy/ygN2y5JvsGEAnwmIjLQimyeDZeDt92UXl6sr423tWD/N7ZGTvu\n 4u2ecPVQ01LzMOBCoMDBush+9rY1Csjk29pQqaQmwnNI0GRnsSyj+I52REz8NsZixWd1\n SIztbqzi3rrxOkQ1SDEbVszJYgQItJYTXvpW3uYB4x5FDBOnvea7UKdxA4z5M4Xnw71h\n 7ThcBECtzWE84c2n4fuCItGvlPOWM1HYeiC2GNnmBkbs24u6bUO3rhBL6wRw9fVmJvJe\n ijUg=="
        ],
        "X-MC-Unique": "TrcK_ewpO_mM-uwv1n1J7g-1",
        "X-Mimecast-MFC-AGG-ID": "TrcK_ewpO_mM-uwv1n1J7g_1775667380",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775667380; x=1776272180;\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=y3AUfIp5hhwSuzshcuDyBJj3UN6iMbkU2aTwINm6YxQ=;\n b=f7lOO062fQzE2BTCm2lKxjXkEyXpwPgFKUanvWAy8HqAC4vWD8gVo6Gu61orIQ9EwT\n ziJIVhaVsT945GiSB/6p4jS1NuFkQxgc4ODffXGAE8IYSWhxD/Sbt3NZ8k2O8rEH6NB4\n UHg5zDdZfwKTVom1FPtdLpbGSqbND/ZCgNmayrO2a4VUnmBRBK74doWXawF+JteGI/SS\n /+G2QlRGrZocsTJYJG8KU64qsHSqhQl1cGf0iQcKRDFRvpaSh9jJMdWyNzdebDAU2gcw\n bWoaA9XuEZx+3ix1BYGDoJ4UWi7twjSGgr0jhd3XjnI6zLki1q3fmWo9ipRNTYNYCkw8\n FICA==",
        "X-Gm-Message-State": "AOJu0YyAYBpaUB7Q54ZlMqWc8ngL2sBtBCJm/GW/RLsgvFA0FsyIxNPF\n L0X3LVZSWp35160MyXdJdR9J/VnqJhxeph6YdKHQTwY0VZLLifryP6hsHwGhUakvReiZ2lXDmTu\n mG1MtSHME4zpy+dCuyY+aAPDYhm/UhA1+77ooyHM1dirtYVpDt9FCtMLYtkHDvTIIBuUNoIqAJd\n CBMx9hD5CE3vwnqpzg0iNfQCTQAMRYVm4suu555Q==",
        "X-Gm-Gg": "AeBDieuZThkbOJyLTR3u3Z8pTF4vr/DBnJEzlJTY8lk2b49Wv0pnXO504jzXPq1QWXP\n 5cw/xlfxE0F1cJManaXyYfYuPPh/fa/QLuMPGzo/4oWRuISYfU+8rTio+3+dEeUNFvhDSqzKyTG\n KIx37Cwj7FB8ndijJhxr/mg7QVNg1qvvoA3ye4Dvv0pzM06fU4WF6dWD48J2YP89fkHcAaM7Ldx\n y7LdFL9YRT7sca53q4doHa+Hld+89s1FHlfyuCLrVG+YDjIToD3gMqig6HK5maDgoRH63SxyWEI\n 8S3m3MJjo3NWUPPanjsvzO+4Yvjib+I/RADa3vWgQcFIZcjMZ5r5rafORy9sNmp++TYvmsxZevE\n rvCBilHIihFcYtIBj39mQrl1i+i/5JkHTM78jD70uWVjM",
        "X-Received": [
            "by 2002:a05:622a:229f:b0:50d:7b0c:35e7 with SMTP id\n d75a77b69052e-50d7b0c40a9mr260168291cf.43.1775667379767;\n Wed, 08 Apr 2026 09:56:19 -0700 (PDT)",
            "by 2002:a05:622a:229f:b0:50d:7b0c:35e7 with SMTP id\n d75a77b69052e-50d7b0c40a9mr260167531cf.43.1775667379154;\n Wed, 08 Apr 2026 09:56:19 -0700 (PDT)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "\"Maciej S . Szmigiero\" <mail@maciej.szmigiero.name>, =?utf-8?q?Daniel_P_?=\n\t=?utf-8?q?=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n Zhiyi Guo <zhguo@redhat.com>, Juraj Marcin <jmarcin@redhat.com>,\n Peter Xu <peterx@redhat.com>, Prasad Pandit <ppandit@redhat.com>,\n Avihai Horon <avihaih@nvidia.com>, Kirti Wankhede <kwankhede@nvidia.com>,\n\t=?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>,\n Fabiano Rosas <farosas@suse.de>, Joao Martins <joao.m.martins@oracle.com>,\n Markus Armbruster <armbru@redhat.com>, Alex Williamson <alex@shazbot.org>",
        "Subject": "[PATCH 12/14] migration: Fix calculation of expected_downtime to take\n VFIO info",
        "Date": "Wed,  8 Apr 2026 12:55:56 -0400",
        "Message-ID": "<20260408165559.157108-13-peterx@redhat.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260408165559.157108-1-peterx@redhat.com>",
        "References": "<20260408165559.157108-1-peterx@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com",
        "X-Spam_score_int": "-25",
        "X-Spam_score": "-2.6",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\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_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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": "QEMU will provide an expected downtime for the whole system during\nmigration, by remembering the total dirty RAM that we synced the last time,\ndivides the estimated switchover bandwidth.\n\nThat was flawed when VFIO is taking into account: consider there is a VFIO\nGPU device that contains GBs of data to migrate during stop phase.  Those\nwill not be accounted in this math.\n\nFix it by updating dirty_bytes_last_sync properly only when we go to the\nnext iteration, rather than hide this update in the RAM code.  Meanwhile,\nfetch the total (rather than RAM-only) portion of dirty bytes, so as to\ninclude GPU device states too.\n\nUpdate the comment of the field to reflect its new meaning.\n\nNow after this change, the expected-downtime to be read from query-migrate\nshould be very accurate even with VFIO devices involved.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n migration/migration-stats.h |  8 +++-----\n migration/migration.c       | 11 ++++++++---\n migration/ram.c             |  1 -\n 3 files changed, 11 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/migration/migration-stats.h b/migration/migration-stats.h\nindex 326ddb0088..1447316802 100644\n--- a/migration/migration-stats.h\n+++ b/migration/migration-stats.h\n@@ -31,11 +31,9 @@\n  */\n typedef struct {\n     /*\n-     * Number of bytes that were dirty last time that we synced with\n-     * the guest memory.  We use that to calculate the downtime.  As\n-     * the remaining dirty amounts to what we know that is still dirty\n-     * since last iteration, not counting what the guest has dirtied\n-     * since we synchronized bitmaps.\n+     * Number of bytes that were reported dirty after the lastest\n+     * system-wise synchronization on dirty information.  It is used to\n+     * do best-effort estimation on expected downtime.\n      */\n     uint64_t dirty_bytes_last_sync;\n     /*\ndiff --git a/migration/migration.c b/migration/migration.c\nindex f12cd9efd3..4010e5dcf5 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -3240,18 +3240,23 @@ static void migration_iteration_go_next(MigPendingData *pending)\n      */\n     qemu_savevm_query_pending(pending, true);\n \n+    /*\n+     * Update the dirty information for the whole system for this\n+     * iteration.  This value is used to calculate expected downtime.\n+     */\n+    qatomic_set(&mig_stats.dirty_bytes_last_sync, pending->total_bytes);\n+\n     /*\n      * Boost dirty sync count to reflect we finished one iteration.\n      *\n      * NOTE: we need to make sure when this happens (together with the\n      * event sent below) all modules have slow-synced the pending data\n-     * above.  That means a write mem barrier, but qatomic_add() should be\n-     * enough.\n+     * above and updated corresponding fields (e.g. dirty_bytes_last_sync).\n      *\n      * It's because a mgmt could wait on the iteration event to query again\n      * on pending data for policy changes (e.g. downtime adjustments).  The\n      * ordering will make sure the query will fetch the latest results from\n-     * all the modules.\n+     * all the modules on everything.\n      */\n     qatomic_add(&mig_stats.dirty_sync_count, 1);\n \ndiff --git a/migration/ram.c b/migration/ram.c\nindex 686162643d..d927ad7508 100644\n--- a/migration/ram.c\n+++ b/migration/ram.c\n@@ -1148,7 +1148,6 @@ static void migration_bitmap_sync(RAMState *rs, bool last_stage)\n             RAMBLOCK_FOREACH_NOT_IGNORED(block) {\n                 ramblock_sync_dirty_bitmap(rs, block);\n             }\n-            qatomic_set(&mig_stats.dirty_bytes_last_sync, ram_bytes_remaining());\n         }\n     }\n \n",
    "prefixes": [
        "12/14"
    ]
}