Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216588/?format=api
{ "id": 2216588, "url": "http://patchwork.ozlabs.org/api/patches/2216588/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326210532.379027-9-peterx@redhat.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": "<20260326210532.379027-9-peterx@redhat.com>", "list_archive_url": null, "date": "2026-03-26T21:05:29", "name": "[RFC,v2,08/11] vmstate: Implement load of ptr marker in vmstate core", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5a51c079123783e1a61b3a5b66dad1aa15a5818e", "submitter": { "id": 67717, "url": "http://patchwork.ozlabs.org/api/people/67717/?format=api", "name": "Peter Xu", "email": "peterx@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326210532.379027-9-peterx@redhat.com/mbox/", "series": [ { "id": 497651, "url": "http://patchwork.ozlabs.org/api/series/497651/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497651", "date": "2026-03-26T21:05:22", "name": "vmstate: Implement VMS_ARRAY_OF_POINTER_AUTO_ALLOC", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497651/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216588/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216588/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=LyFyV8Kq;\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=I9hgHL0Q;\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 4fhbvJ4WwPz1yFr\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 08:07:24 +1100 (AEDT)", "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 1w5rts-0004Aa-BR; Thu, 26 Mar 2026 17:05:56 -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 <peterx@redhat.com>) id 1w5rtn-000490-11\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 17:05:51 -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 1w5rtl-00037d-CP\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 17:05:50 -0400", "from mail-qk1-f198.google.com (mail-qk1-f198.google.com\n [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-626-KLeZFTGQP2CF_jLzXtMaSQ-1; Thu, 26 Mar 2026 17:05:47 -0400", "by mail-qk1-f198.google.com with SMTP id\n af79cd13be357-8cfc5294894so464506285a.1\n for <qemu-devel@nongnu.org>; Thu, 26 Mar 2026 14:05:47 -0700 (PDT)", "from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8d00e4fa7d9sm353479785a.32.2026.03.26.14.05.45\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 26 Mar 2026 14:05:45 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774559148;\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=1lTxzlXPcIkLTIzQtm5snIna0fiWyl7m583Ny0gqjgk=;\n b=LyFyV8KqgbbbUPTTq0Pgd6Ui4K1RD6JtqOGRY5UE0HQgilq+W9V9DIEzTXQaGRV1WdFcPA\n QJchM2bzR398MbzmFDMhiFA/aGetFC/cQR7fPawkA8oVg/tpFyUoLFLnuyOfpERHLYoJxm\n anUisCAtyzUnSnax0KiHe1SbMsKWlRU=", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1774559146; x=1775163946; 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=1lTxzlXPcIkLTIzQtm5snIna0fiWyl7m583Ny0gqjgk=;\n b=I9hgHL0QdibFZn5aR9wt0C6CI0J2vsSzVx10RNVMNMNE70bI4G44qKdp/HSiOQJ+mV\n f/g/PEWpvBxPB/aUnfzCvm30JXEZ8EQgQ13YocjaGcdvqOXumf0CTbIOIbmGJKfoU6Qi\n jAmu/2ECtefXrRo7dwEBXyUaq2D95QVfkt4NEomgpVhju0iFVIVLGGeIRoPdMmbxw5pG\n nPQl6QN/0GEAn4FLeOfzdRVyezzLWmC6Cnt/KleWI2Tfhok5ZY4AjKSRzjsykmU2Kgtm\n b6qf3i5puE4BLOMlRku2zjcGEdMNuW2Kn45yECny40NKP3lR1dFQD9mqjO/gRxFDxzO9\n icZw==" ], "X-MC-Unique": "KLeZFTGQP2CF_jLzXtMaSQ-1", "X-Mimecast-MFC-AGG-ID": "KLeZFTGQP2CF_jLzXtMaSQ_1774559147", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774559146; x=1775163946;\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=1lTxzlXPcIkLTIzQtm5snIna0fiWyl7m583Ny0gqjgk=;\n b=gFAPduvGlMcZ87agwbtJnbEMMjg/sEjlVo+MRF3v54arTHei3gXMj/7TDSf5AksWpW\n /JFUCec6vlsuxV318EO1fctF7HtD2NZOSsXwHmEVo3YrDmR+PTYszF1kistE6zALP2Cx\n RrdhYoUu61ylbn8FgaW/mFCtZFcVFX5RkqE04D8Ct1ToZJGg+Fu6LV1mY8fPqcg06bGx\n efo/mcoVmNP2cIpspvzvcx1O6a+w04S7ll7FvPN3s7Q2A9natW5WUfJ2ztmY9XkwXYrV\n XMhhQFpfrfgdmQmFkeAhwBubTDOnWpWdSOmd5UML4/JjLJP80amOPV+GT0eWH5dyBjmJ\n pHkg==", "X-Gm-Message-State": "AOJu0YwDfJEbHaFWTCdAfc8iH8LgFr9/jRQpayam4MqKpKMvCw6UHBwH\n 9RSs6GG2WvFsTyZdhRW/jMvPbyvZbicsaYSC0SFTGI2hXQn4xjuGqFqL+k/Lwe9LzaxrwkxFXYP\n 9KcnjOESt2cSGFok8uhiPewNkTbjYX8VkxtTImqtDd/1Cz0hcd+Kna0YdEdh9sf17FgsdkC7b5H\n Z0mWep/QR57+FCplQEOEHWsrJnlgDbfcgGagSCKw==", "X-Gm-Gg": "ATEYQzw6Hrw9i0ftephe5WPgaCgxfFMeWkljOWhSR6YnltANsDtXFPeODN6TGD7YSbm\n YzXGdAtINFyX03e/X1sPdl4laUL1vLNIC5L0q4xR52eHf0Ss/7KSD1Ik2bqMQz2wSgAYncyWrvH\n HAEIHCKgHe54vfnYO5RJbsi435LUJezFscIw6fxjbx2+JO2+YnGMWNrh3+W5rVsRcBQ6W+ge0d5\n o6GyvQhcGxlcseCFfdUOTyLmXDP5mhTJdHAFOaCzNfVCGSwRxnW3t++FEalFKKgLbWeJpeFNP37\n KvWJyd7KVktLXTovnF1bWNSuhHaom6oKLmRoUglfnKmDxwMy9BZbF0eV55rJEDdmvzfkz1LvehA\n Mn/tsTPjAUfE=", "X-Received": [ "by 2002:a05:620a:1a22:b0:8cd:8ddd:2699 with SMTP id\n af79cd13be357-8d000f5cd3amr1239516885a.24.1774559146311;\n Thu, 26 Mar 2026 14:05:46 -0700 (PDT)", "by 2002:a05:620a:1a22:b0:8cd:8ddd:2699 with SMTP id\n af79cd13be357-8d000f5cd3amr1239511985a.24.1774559145805;\n Thu, 26 Mar 2026 14:05:45 -0700 (PDT)" ], "From": "Peter Xu <peterx@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Alexander Mikhalitsyn <alexander@mihalicyn.com>, peterx@redhat.com,\n Fabiano Rosas <farosas@suse.de>, Juraj Marcin <jmarcin@redhat.com>", "Subject": "[PATCH RFC v2 08/11] vmstate: Implement load of ptr marker in vmstate\n core", "Date": "Thu, 26 Mar 2026 17:05:29 -0400", "Message-ID": "<20260326210532.379027-9-peterx@redhat.com>", "X-Mailer": "git-send-email 2.50.1", "In-Reply-To": "<20260326210532.379027-1-peterx@redhat.com>", "References": "<20260326210532.379027-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": "-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_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": "The loader side of ptr marker is pretty straightforward, instead of playing\nthe inner_field trick, just do the load manually assuming the marker layout\nis a stable ABI (which it is true already).\n\nThis will remove some logic while loading VMSD, and hopefully it makes it\nslightly easier to read. Unfortunately, we still need to keep the sender\nside because of the JSON blob we're maintaining..\n\nThis paves way for future processing of non-NULL markers as well.\n\nWhen at it, not check \"size\" anymore for existing NULL markers, and move it\nunder the same VMS_ARRAY_OF_POINTER section because that's the only place\nthat NULL marker can happen (which guarantess size==host ptr size, which is\nnon-zero).\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\n---\n migration/vmstate-types.c | 12 ++++------\n migration/vmstate.c | 46 ++++++++++++++++++++++++---------------\n 2 files changed, 32 insertions(+), 26 deletions(-)", "diff": "diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c\nindex b31689fc3c..ae465c5c2c 100644\n--- a/migration/vmstate-types.c\n+++ b/migration/vmstate-types.c\n@@ -363,14 +363,10 @@ static bool load_ptr_marker(QEMUFile *f, void *pv, size_t size,\n const VMStateField *field, Error **errp)\n \n {\n- int byte = qemu_get_byte(f);\n-\n- if (byte == VMS_MARKER_PTR_NULL || byte == VMS_MARKER_PTR_VALID) {\n- /* TODO: process PTR_VALID case */\n- return true;\n- }\n-\n- error_setg(errp, \"%s: unexpected ptr marker: %d\", __func__, byte);\n+ /*\n+ * Load is done in vmstate core, see vmstate_ptr_marker_load().\n+ */\n+ g_assert_not_reached();\n return false;\n }\n \ndiff --git a/migration/vmstate.c b/migration/vmstate.c\nindex b333aa1744..47812eb882 100644\n--- a/migration/vmstate.c\n+++ b/migration/vmstate.c\n@@ -142,6 +142,21 @@ static void vmstate_handle_alloc(void *ptr, const VMStateField *field,\n }\n }\n \n+static bool vmstate_ptr_marker_load(QEMUFile *f, bool *load_field,\n+ Error **errp)\n+{\n+ int byte = qemu_get_byte(f);\n+\n+ if (byte == VMS_MARKER_PTR_NULL) {\n+ /* When it's a null ptr marker, do not continue the load */\n+ *load_field = false;\n+ return true;\n+ }\n+\n+ error_setg(errp, \"Unexpected ptr marker: %d\", byte);\n+ return false;\n+}\n+\n static bool vmstate_pre_load(const VMStateDescription *vmsd, void *opaque,\n Error **errp)\n {\n@@ -264,30 +279,25 @@ bool vmstate_load_vmsd(QEMUFile *f, const VMStateDescription *vmsd,\n }\n \n for (i = 0; i < n_elems; i++) {\n- bool ok;\n+ /* If we will process the load of field? */\n+ bool load_field = true;\n+ bool ok = true;\n void *curr_elem = first_elem + size * i;\n- const VMStateField *inner_field;\n \n if (field->flags & VMS_ARRAY_OF_POINTER) {\n curr_elem = *(void **)curr_elem;\n+ if (!curr_elem) {\n+ /* Read the marker instead of VMSD itself */\n+ if (!vmstate_ptr_marker_load(f, &load_field, errp)) {\n+ trace_vmstate_load_field_error(field->name,\n+ -EINVAL);\n+ return false;\n+ }\n+ }\n }\n \n- if (!curr_elem && size) {\n- /*\n- * If null pointer found (which should only happen in\n- * an array of pointers), use null placeholder and do\n- * not follow.\n- */\n- inner_field = vmsd_create_ptr_marker_field(field);\n- } else {\n- inner_field = field;\n- }\n-\n- ok = vmstate_load_field(f, curr_elem, size, inner_field, errp);\n-\n- /* If we used a fake temp field.. free it now */\n- if (inner_field != field) {\n- g_clear_pointer((gpointer *)&inner_field, g_free);\n+ if (load_field) {\n+ ok = vmstate_load_field(f, curr_elem, size, field, errp);\n }\n \n if (ok) {\n", "prefixes": [ "RFC", "v2", "08/11" ] }