get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2227465,
    "url": "http://patchwork.ozlabs.org/api/patches/2227465/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423191958.1440-6-farosas@suse.de/",
    "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": "<20260423191958.1440-6-farosas@suse.de>",
    "list_archive_url": null,
    "date": "2026-04-23T19:19:19",
    "name": "[PULL,05/43] migration: make .post_save() a void function",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "961c2191a763252d7a1012b50d9240c1288395f3",
    "submitter": {
        "id": 85343,
        "url": "http://patchwork.ozlabs.org/api/people/85343/?format=api",
        "name": "Fabiano Rosas",
        "email": "farosas@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423191958.1440-6-farosas@suse.de/mbox/",
    "series": [
        {
            "id": 501236,
            "url": "http://patchwork.ozlabs.org/api/series/501236/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501236",
            "date": "2026-04-23T19:19:14",
            "name": "[PULL,01/43] checkpatch: Allow spaces after all coroutine annotations",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501236/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2227465/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2227465/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=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=V2qU2uqv;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=4OFwzZip;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=PlRc8HQ/;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=g3xSr8Fd;\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)",
            "smtp-out2.suse.de;\n\tnone"
        ],
        "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 4g1mGF74vFz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 05:23:17 +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 1wFzb3-0001p4-7X; Thu, 23 Apr 2026 15:20:21 -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 <farosas@suse.de>) id 1wFzb2-0001oq-05\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 15:20:20 -0400",
            "from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <farosas@suse.de>) id 1wFzaz-0001l6-VB\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 15:20:19 -0400",
            "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out2.suse.de (Postfix) with ESMTPS id EB1475BD43;\n Thu, 23 Apr 2026 19:20:08 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B3382593A3;\n Thu, 23 Apr 2026 19:20:07 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id MIzOH+dw6mlJCwAAD6G6ig\n (envelope-from <farosas@suse.de>); Thu, 23 Apr 2026 19:20:07 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776972009;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=SW9G0EYa6E6Tg/mKSmoKUz9WbeXqnsVcQ2JCueVsOkk=;\n b=V2qU2uqv+P2qtJ49qdNvMTlwDZG8l9Bs6Yrms4Pfwh03JjL1MBGQVLqR/8PyibhfoRPHqq\n guUqi7a8CxpsuCXaJHjBsLHmS3f7cadcbQgJjJ4W1d3OY7MEEB8ASuN+ctCczI86b59mFZ\n BABi4+dHFCkbueFPJ7JvZD10E0en3DY=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776972009;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=SW9G0EYa6E6Tg/mKSmoKUz9WbeXqnsVcQ2JCueVsOkk=;\n b=4OFwzZipFRWthgDNcHG4jFZCzcny01Kr9vkNZc/Tq7DYJt6u44G0hiDLg5ZBoz0eIuzYlG\n qcnGXd4lFILpqJDA==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776972008;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=SW9G0EYa6E6Tg/mKSmoKUz9WbeXqnsVcQ2JCueVsOkk=;\n b=PlRc8HQ/CrHjCfclTihGf1Pjc24sDvOnZG1vabi1pWFUxhtHWsqaHL6ho1V/zaAdPomLzK\n E1Fcnyhr/H6HslnUQ+B6RvGJxdgrwSZ6ni6NbMqvJrzjBWoXq34+5s5paIktMQyr3NoqXW\n iz0pfiGSTyzF6YVVoM3RczMbvolFwjE=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776972008;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=SW9G0EYa6E6Tg/mKSmoKUz9WbeXqnsVcQ2JCueVsOkk=;\n b=g3xSr8Fd6QhP211N2JbNWBmeF8jaMm/1DLZq8zHLJl9IXfdIh73iboThgHjtcZ52IFcaNN\n cN0Svvdvzk059BCg=="
        ],
        "From": "Fabiano Rosas <farosas@suse.de>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Peter Xu <peterx@redhat.com>,\n Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,\n Zhao Liu <zhao1.liu@intel.com>",
        "Subject": "[PULL 05/43] migration: make .post_save() a void function",
        "Date": "Thu, 23 Apr 2026 16:19:19 -0300",
        "Message-ID": "<20260423191958.1440-6-farosas@suse.de>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20260423191958.1440-1-farosas@suse.de>",
        "References": "<20260423191958.1440-1-farosas@suse.de>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Spam-Score": "-2.80",
        "X-Spamd-Result": "default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[];\n R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000];\n MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+];\n TO_DN_SOME(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,intel.com:email,suse.de:mid,suse.de:email];\n RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[];\n RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]",
        "Received-SPF": "pass client-ip=2a07:de40:b251:101:10:150:64:2;\n envelope-from=farosas@suse.de; helo=smtp-out2.suse.de",
        "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, 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: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>\n\nAll other handlers now have _errp() variants. Should we go this way\nfor .post_save()? Actually it's rather strange, when the vmstate do\nsuccessful preparations in .pre_save(), then successfully save all\nsections and subsections, end then fail when all the state is\nsuccessfully transferred to the target.\n\nHappily, we have only three .post_save() realizations, all always\nsuccessful. Let's make this a rule.\n\nAlso note, that we call .post_save() in two places, and handle\nits (theoretical) failure inconsistently. Fix that too.\n\nSigned-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>\nReviewed-by: Peter Xu <peterx@redhat.com>\nReviewed-by: Zhao Liu <zhao1.liu@intel.com> #rust\nLink: https://lore.kernel.org/qemu-devel/20260304212303.667141-4-vsementsov@yandex-team.ru\nSigned-off-by: Fabiano Rosas <farosas@suse.de>\n---\n docs/devel/migration/main.rst    |  2 +-\n hw/ppc/spapr_pci.c               |  3 +--\n include/migration/vmstate.h      |  8 +++++++-\n migration/savevm.c               |  3 +--\n migration/vmstate.c              | 12 +++---------\n rust/migration/src/migratable.rs |  6 ++----\n rust/migration/src/vmstate.rs    | 12 +++++++-----\n target/arm/machine.c             |  4 +---\n 8 files changed, 23 insertions(+), 27 deletions(-)",
    "diff": "diff --git a/docs/devel/migration/main.rst b/docs/devel/migration/main.rst\nindex 234d280249..2de7050764 100644\n--- a/docs/devel/migration/main.rst\n+++ b/docs/devel/migration/main.rst\n@@ -439,7 +439,7 @@ The functions to do that are inside a vmstate definition, and are called:\n \n   This function is called before we save the state of one device.\n \n-- ``int (*post_save)(void *opaque);``\n+- ``void (*post_save)(void *opaque);``\n \n   This function is called after we save the state of one device\n   (even upon failure, unless the call to pre_save returned an error).\ndiff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c\nindex ea998bdff1..1dc3b02659 100644\n--- a/hw/ppc/spapr_pci.c\n+++ b/hw/ppc/spapr_pci.c\n@@ -2093,14 +2093,13 @@ static int spapr_pci_pre_save(void *opaque)\n     return 0;\n }\n \n-static int spapr_pci_post_save(void *opaque)\n+static void spapr_pci_post_save(void *opaque)\n {\n     SpaprPhbState *sphb = opaque;\n \n     g_free(sphb->msi_devs);\n     sphb->msi_devs = NULL;\n     sphb->msi_devs_num = 0;\n-    return 0;\n }\n \n static int spapr_pci_post_load(void *opaque, int version_id)\ndiff --git a/include/migration/vmstate.h b/include/migration/vmstate.h\nindex 78d97151bd..9d42cf7a64 100644\n--- a/include/migration/vmstate.h\n+++ b/include/migration/vmstate.h\n@@ -223,7 +223,13 @@ struct VMStateDescription {\n     bool (*post_load_errp)(void *opaque, int version_id, Error **errp);\n     int (*pre_save)(void *opaque);\n     bool (*pre_save_errp)(void *opaque, Error **errp);\n-    int (*post_save)(void *opaque);\n+\n+    /*\n+     * Unless .pre_save() fails, .post_save() is called after saving\n+     * fields and subsections. It should not fail because at this\n+     * point the state has potentially already been transferred.\n+     */\n+    void (*post_save)(void *opaque);\n     bool (*needed)(void *opaque);\n     bool (*dev_unplug_pending)(void *opaque);\n \ndiff --git a/migration/savevm.c b/migration/savevm.c\nindex dd58f2a705..699d2c9f8b 100644\n--- a/migration/savevm.c\n+++ b/migration/savevm.c\n@@ -321,14 +321,13 @@ static int configuration_pre_save(void *opaque)\n     return 0;\n }\n \n-static int configuration_post_save(void *opaque)\n+static void configuration_post_save(void *opaque)\n {\n     SaveState *state = opaque;\n \n     g_free(state->capabilities);\n     state->capabilities = NULL;\n     state->caps_count = 0;\n-    return 0;\n }\n \n static int configuration_pre_load(void *opaque)\ndiff --git a/migration/vmstate.c b/migration/vmstate.c\nindex 651c3fe011..5111e7a141 100644\n--- a/migration/vmstate.c\n+++ b/migration/vmstate.c\n@@ -550,10 +550,7 @@ static int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,\n                 if (ret) {\n                     error_prepend(errp, \"Save of field %s/%s failed: \",\n                                   vmsd->name, field->name);\n-                    if (vmsd->post_save) {\n-                        vmsd->post_save(opaque);\n-                    }\n-                    return ret;\n+                    goto out;\n                 }\n \n                 /* Compressed arrays only care about the first element */\n@@ -578,12 +575,9 @@ static int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,\n \n     ret = vmstate_subsection_save(f, vmsd, opaque, vmdesc, errp);\n \n+out:\n     if (vmsd->post_save) {\n-        int ps_ret = vmsd->post_save(opaque);\n-        if (!ret && ps_ret) {\n-            ret = ps_ret;\n-            error_setg(errp, \"post-save failed: %s\", vmsd->name);\n-        }\n+        vmsd->post_save(opaque);\n     }\n     return ret;\n }\ndiff --git a/rust/migration/src/migratable.rs b/rust/migration/src/migratable.rs\nindex 7748aac2f2..b9e5e1fc15 100644\n--- a/rust/migration/src/migratable.rs\n+++ b/rust/migration/src/migratable.rs\n@@ -406,10 +406,8 @@ fn pre_save(&self) -> Result<(), InvalidError> {\n         Ok(())\n     }\n \n-    fn post_save(&self) -> Result<(), InvalidError> {\n-        let state = unsafe { Box::from_raw(self.migration_state.replace(ptr::null_mut())) };\n-        drop(state);\n-        Ok(())\n+    fn post_save(&self) {\n+        let _ = unsafe { Box::from_raw(self.migration_state.replace(ptr::null_mut())) };\n     }\n \n     fn pre_load(&self) -> Result<(), InvalidError> {\ndiff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs\nindex edc7c70265..f34a36f680 100644\n--- a/rust/migration/src/vmstate.rs\n+++ b/rust/migration/src/vmstate.rs\n@@ -492,6 +492,11 @@ fn from(_value: InvalidError) -> Errno {\n     into_neg_errno(result)\n }\n \n+unsafe extern \"C\" fn vmstate_post_save_cb<T, F: for<'a> FnCall<(&'a T,), ()>>(opaque: *mut c_void) {\n+    // SAFETY: the function is used in T's implementation of VMState.\n+    F::call((unsafe { &*(opaque.cast::<T>()) },));\n+}\n+\n unsafe extern \"C\" fn vmstate_post_load_cb<\n     T,\n     F: for<'a> FnCall<(&'a T, u8), Result<(), impl Into<Errno>>>,\n@@ -597,12 +602,9 @@ pub const fn pre_save<F: for<'a> FnCall<(&'a T,), Result<(), impl Into<Errno>>>>\n     }\n \n     #[must_use]\n-    pub const fn post_save<F: for<'a> FnCall<(&'a T,), Result<(), impl Into<Errno>>>>(\n-        mut self,\n-        _f: &F,\n-    ) -> Self {\n+    pub const fn post_save<F: for<'a> FnCall<(&'a T,), ()>>(mut self, _f: &F) -> Self {\n         self.0.post_save = if F::IS_SOME {\n-            Some(vmstate_no_version_cb::<T, F>)\n+            Some(vmstate_post_save_cb::<T, F>)\n         } else {\n             None\n         };\ndiff --git a/target/arm/machine.c b/target/arm/machine.c\nindex b0e499515c..50d80ffb68 100644\n--- a/target/arm/machine.c\n+++ b/target/arm/machine.c\n@@ -998,7 +998,7 @@ static int cpu_pre_save(void *opaque)\n     return 0;\n }\n \n-static int cpu_post_save(void *opaque)\n+static void cpu_post_save(void *opaque)\n {\n     ARMCPU *cpu = opaque;\n \n@@ -1008,8 +1008,6 @@ static int cpu_post_save(void *opaque)\n \n     cpu->cpreg_vmstate_indexes = NULL;\n     cpu->cpreg_vmstate_values = NULL;\n-\n-    return 0;\n }\n \n static int cpu_pre_load(void *opaque)\n",
    "prefixes": [
        "PULL",
        "05/43"
    ]
}