get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2233227,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2233227/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505202640.1011006-14-peterx@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": "<20260505202640.1011006-14-peterx@redhat.com>",
    "date": "2026-05-05T20:26:30",
    "name": "[PULL,13/23] migration: Calculate expected downtime on demand",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e25c974a47da0c412cf401d593616b5e94eef7b9",
    "submitter": {
        "id": 67717,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/67717/?format=api",
        "name": "Peter Xu",
        "email": "peterx@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260505202640.1011006-14-peterx@redhat.com/mbox/",
    "series": [
        {
            "id": 502897,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/502897/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502897",
            "date": "2026-05-05T20:26:17",
            "name": "[PULL,01/23] migration: Fix blocking in POSTCOPY_DEVICE during package load",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/502897/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2233227/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2233227/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=CV+cO9gM;\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=QAULvYuU;\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 4g999Y5Zv2z1yJV\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 06:29:53 +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 1wKMML-0004ZZ-R8; Tue, 05 May 2026 16:27:13 -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 1wKMMD-0004T1-2n\n for qemu-devel@nongnu.org; Tue, 05 May 2026 16:27:05 -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 1wKMMB-0002dV-FD\n for qemu-devel@nongnu.org; Tue, 05 May 2026 16:27:04 -0400",
            "from mail-qt1-f198.google.com (mail-qt1-f198.google.com\n [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-343-Z1ktgMWzMAWAtXN9U5DPBQ-1; Tue, 05 May 2026 16:27:01 -0400",
            "by mail-qt1-f198.google.com with SMTP id\n d75a77b69052e-50da529ff48so133026111cf.3\n for <qemu-devel@nongnu.org>; Tue, 05 May 2026 13:27:01 -0700 (PDT)",
            "from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8b53c6b8123sm155283806d6.35.2026.05.05.13.26.58\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 05 May 2026 13:26:59 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1778012822;\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=WZf+roECEzrRMn9PvQ2Od9IyuK2k8H7PDFoPmYm9/54=;\n b=CV+cO9gMx+9N9G1Qg6uCVNC4ooxptbxLMwxeA7HcwN9w7d4pn2TazlbA/XvtaRUSh3D4Mc\n LcmbpW09hG7DRnmvGv6pk9RG2eNWyX6rU1enP+fFT0HWjVzAKHczKEydUifD8MvJG1TOiB\n FCgM00wLv9RZyEs7JX2drNKHtUCx4pY=",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1778012820; x=1778617620; 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=WZf+roECEzrRMn9PvQ2Od9IyuK2k8H7PDFoPmYm9/54=;\n b=QAULvYuUlFx4luh36bL8yQPWJAwdaYf1KpIcnCJmxvmjNm3we817OqVLp54TeEJrXo\n pubzMkSIlojDcNjCxUx+TsGic1ZKdzYIZOq37n3+aGvJrt3/iqB8z5xbj5eR+usCBjzI\n soQRPpl/0wo9CPRIvI4vv34/CYwhERjcrGAjau5XLWMob1TeLqinEPiHwGq5BtrA5rmm\n g5/O7mdvydOp3gm7N4WuKyS4k8O2248BCqkKMaPy2oXPfG/AqVRqJ6JhLIXWPjdLJAEs\n GRE27o2zQWgzvAPkjQnm8hnkELymhxkNKAao1UwqVWP24xGmWaak2o71BVLE2C+FCH/k\n XelQ=="
        ],
        "X-MC-Unique": "Z1ktgMWzMAWAtXN9U5DPBQ-1",
        "X-Mimecast-MFC-AGG-ID": "Z1ktgMWzMAWAtXN9U5DPBQ_1778012821",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1778012820; x=1778617620;\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=WZf+roECEzrRMn9PvQ2Od9IyuK2k8H7PDFoPmYm9/54=;\n b=EQXe4BuoyFKVUyx/N/gTp028Xt2Wb9/b4Cna0hz/p7douClMPZFT3WZagMqcfb/pgP\n rJEPtXeztq7oKDytXQLLWr0si0MnrroUTl1G2fjtqnLETZ/6JmZJ/GK+r0jtd8W3iHDn\n byJIQmEWk1CD5xC3M4E9Lm6MBGeKKwrRIX5Afxwcsut22HZWtuQooAQC5w2xoWlVMiDj\n Bckg5+3SsBsrlP1ioLvnIBcGx+i3UXAA0wm1xyUn1LC3LnYWGpjD/TIZSayRALk6jmY8\n SiZLppF5Bc0snDSa1ut+wFFFvhyKbCWB6S6Eoi+awqzHc8YFSNeitdCUttUqc/srqgmF\n mYDQ==",
        "X-Gm-Message-State": "AOJu0YxGUbM5v+NMZtLjy3UirLowNN7KsH6fS38SdWKrdpRzkR1H35TN\n ggOSIC8LfkAc+4Gck3U4xROLVbE4sntpOa/ocPQcdOKtxMW16QPK7Rz8CheNB2OCw/BG9x3VfhP\n dKDuqoSSFEKqZViI7KYwj4bW1NDnlVwFwTC/xPpqQg6aDLbvk5DkKfqrrrWLLvZxCAPP0u+Qt2z\n No3+LJclAiCJFZrP3ILzkBmNaU8E/XbBnrjXA6pA==",
        "X-Gm-Gg": "AeBDieuyEDGqHzH72xQSkQM8RDOGIWu81pCgds7EZQyQk8rLl+0wGh9p9vVGB00L6YX\n jvSsXINy98aEefwrfwgJ8bMdNXF/MRAjXyXv7IJlup84RfAV8TmgQ5A+RKRtaDAAurda1jWMi02\n 3iwG9kvgsIRO95VKUrd4jLM9wT6ep4Rc5KuAzwmqWvtMyby7SwlIjlNN81Ox3M+Ol3vQHxBdeuk\n mQurNNm2dkgXgWRHXOtiL8HKfFCtN/yByB9vr5dK6qBTdMbCwQoyaVsDSs2PRp6Y9L4ohtvCGuI\n peVNb2OnpDxwlcV2spVBVbiA4mGVFGLPpFwRp6djB8xKZ1u50HQmzBZSiwsP2UCiFDPiaAk0ZVq\n t1K9gAUrGNGwuQRKMvPbTWbEVUHyEEmkuVtqIOX/2Vcse95Z4rQUo3qg=",
        "X-Received": [
            "by 2002:a05:622a:242:b0:50d:a6a0:8f09 with SMTP id\n d75a77b69052e-51461f7f0c8mr9083911cf.39.1778012820262;\n Tue, 05 May 2026 13:27:00 -0700 (PDT)",
            "by 2002:a05:622a:242:b0:50d:a6a0:8f09 with SMTP id\n d75a77b69052e-51461f7f0c8mr9083191cf.39.1778012819421;\n Tue, 05 May 2026 13:26:59 -0700 (PDT)"
        ],
        "From": "Peter Xu <peterx@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Fabiano Rosas <farosas@suse.de>, Paolo Bonzini <pbonzini@redhat.com>,\n Peter Xu <peterx@redhat.com>, Juraj Marcin <jmarcin@redhat.com>",
        "Subject": "[PULL 13/23] migration: Calculate expected downtime on demand",
        "Date": "Tue,  5 May 2026 16:26:30 -0400",
        "Message-ID": "<20260505202640.1011006-14-peterx@redhat.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260505202640.1011006-1-peterx@redhat.com>",
        "References": "<20260505202640.1011006-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": "-24",
        "X-Spam_score": "-2.5",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.443,\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": "This value does not need to be calculated as frequent.  Only calculate it\non demand when query-migrate happened.  With that we can remove the\nvariable in MigrationState.\n\nThis paves way for fixing this value to include all modules (not only RAM\nbut others too).\n\nReviewed-by: Juraj Marcin <jmarcin@redhat.com>\nLink: https://lore.kernel.org/r/20260421202110.306051-12-peterx@redhat.com\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n migration/migration.h |  2 +-\n migration/migration.c | 25 ++++++++++++-------------\n 2 files changed, 13 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/migration/migration.h b/migration/migration.h\nindex 9081e6a612..a5e064a1ac 100644\n--- a/migration/migration.h\n+++ b/migration/migration.h\n@@ -359,7 +359,6 @@ struct MigrationState {\n     /* Timestamp when VM is down (ms) to migrate the last stuff */\n     int64_t downtime_start;\n     int64_t downtime;\n-    int64_t expected_downtime;\n     bool capabilities[MIGRATION_CAPABILITY__MAX];\n     int64_t setup_time;\n \n@@ -585,6 +584,7 @@ void migration_cancel(void);\n void migration_populate_vfio_info(MigrationInfo *info);\n void migration_reset_vfio_bytes_transferred(void);\n void postcopy_temp_page_reset(PostcopyTmpPage *tmp_page);\n+int64_t migration_downtime_calc_expected(MigrationState *s);\n \n /*\n  * Migration thread waiting for return path thread.  Return non-zero if an\ndiff --git a/migration/migration.c b/migration/migration.c\nindex 4e19fe3409..d740d9df85 100644\n--- a/migration/migration.c\n+++ b/migration/migration.c\n@@ -1041,6 +1041,17 @@ static bool migrate_show_downtime(MigrationState *s)\n     return (s->state == MIGRATION_STATUS_COMPLETED) || migration_in_postcopy();\n }\n \n+/* Return expected downtime (unit: milliseconds) */\n+int64_t migration_downtime_calc_expected(MigrationState *s)\n+{\n+    if (mig_stats.dirty_sync_count <= 1) {\n+        return migrate_downtime_limit();\n+    }\n+\n+    return mig_stats.dirty_bytes_last_sync /\n+        migration_get_switchover_bw(s) * 1000;\n+}\n+\n static void populate_time_info(MigrationInfo *info, MigrationState *s)\n {\n     info->has_status = true;\n@@ -1061,7 +1072,7 @@ static void populate_time_info(MigrationInfo *info, MigrationState *s)\n         info->downtime = s->downtime;\n     } else {\n         info->has_expected_downtime = true;\n-        info->expected_downtime = s->expected_downtime;\n+        info->expected_downtime = migration_downtime_calc_expected(s);\n     }\n }\n \n@@ -1649,7 +1660,6 @@ int migrate_init(MigrationState *s, Error **errp)\n     s->mbps = 0.0;\n     s->pages_per_second = 0.0;\n     s->downtime = 0;\n-    s->expected_downtime = 0;\n     s->setup_time = 0;\n     s->start_postcopy = false;\n     s->migration_thread_running = false;\n@@ -3166,15 +3176,6 @@ static void migration_update_counters(MigrationState *s,\n     s->pages_per_second = (double) transferred_pages /\n                              (((double) time_spent / 1000.0));\n \n-    /*\n-     * if we haven't sent anything, we don't want to\n-     * recalculate. 10000 is a small enough number for our purposes\n-     */\n-    if (mig_stats.dirty_pages_rate && transferred > 10000) {\n-        s->expected_downtime =\n-            mig_stats.dirty_bytes_last_sync / switchover_bw_per_ms;\n-    }\n-\n     migration_rate_reset();\n \n     update_iteration_initial_status(s);\n@@ -3841,8 +3842,6 @@ void migration_start_outgoing(MigrationState *s)\n     bool resume = (s->state == MIGRATION_STATUS_POSTCOPY_RECOVER_SETUP);\n     int ret;\n \n-    s->expected_downtime = migrate_downtime_limit();\n-\n     if (resume) {\n         /* This is a resumed migration */\n         rate_limit = migrate_max_postcopy_bandwidth();\n",
    "prefixes": [
        "PULL",
        "13/23"
    ]
}