Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216581/?format=api
{ "id": 2216581, "url": "http://patchwork.ozlabs.org/api/patches/2216581/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260326210532.379027-4-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-4-peterx@redhat.com>", "list_archive_url": null, "date": "2026-03-26T21:05:24", "name": "[RFC,v2,03/11] vmstate: Do not set size for VMS_ARRAY_OF_POINTER", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c50a262be641d90e79f2c2e51f8ee7a2d982a562", "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-4-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/2216581/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216581/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=CpBEGPcL;\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=o/vx4a9z;\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 4fhbtx0Z8Cz1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 08:07:05 +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 1w5rtj-00047Y-RX; Thu, 26 Mar 2026 17:05:47 -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 1w5rti-00047H-4K\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 17:05:46 -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 1w5rtg-00035s-H9\n for qemu-devel@nongnu.org; Thu, 26 Mar 2026 17:05:45 -0400", "from mail-qk1-f200.google.com (mail-qk1-f200.google.com\n [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-629-jq_vj9EcP_K1SOr8RUe7aA-1; Thu, 26 Mar 2026 17:05:42 -0400", "by mail-qk1-f200.google.com with SMTP id\n af79cd13be357-8cfcf23c0e1so377141785a.2\n for <qemu-devel@nongnu.org>; Thu, 26 Mar 2026 14:05:42 -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.38\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 26 Mar 2026 14:05:39 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774559143;\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=Ubb/xNXuD8MO8IRZHm3DHAIE1nzess2O6rBQSwmPzBQ=;\n b=CpBEGPcLh9mf58XEnnrxAK0itfroDBDXzQIW9w91dn4/pjfdu1jU/EJMGr7R8wUOl2Goss\n 0XIXov9k/j+5++SlIeb8WjT0UUtkjMvaE5FywR6cuMVw8yZFVR+4tazHtg3K96PL5qhAmO\n AaCQxje7Sj74RfosMttA6VAAX+N3vTY=", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1774559141; x=1775163941; 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=Ubb/xNXuD8MO8IRZHm3DHAIE1nzess2O6rBQSwmPzBQ=;\n b=o/vx4a9z4M/cmeED2hz6EaX5+RrhGDmxFqRL5WpLeh7wLw6LYr5uwGc5m+nff524/r\n GVCehSGLMQhLrhokFwwbo/NEexwEqienkJGk0qQAAWBy1Zlool/xkngy+gEssACOpYqJ\n SbYtpSQGynZA8cYilY+nE0uUZKgxXKQN/uo89V6tXucd55eD6zorLSOO78C5uvlGJlAR\n OBBRe3nrRZh1CWqpApde45ivuqcuquf0VmKpihXHaA/lpd9kdbcOv43EU1Z+9WujDpC4\n ndtcxyfnq78Gr3ZyKdfb/DjyN78j1ZPVzDWT1K/0np+UQAd5Tt5hbzcaPIRUaB1QvBt2\n 0wYg==" ], "X-MC-Unique": "jq_vj9EcP_K1SOr8RUe7aA-1", "X-Mimecast-MFC-AGG-ID": "jq_vj9EcP_K1SOr8RUe7aA_1774559141", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774559141; x=1775163941;\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=Ubb/xNXuD8MO8IRZHm3DHAIE1nzess2O6rBQSwmPzBQ=;\n b=IbMPjMzJEiLrEuU7KBuIFBCmvLRnuAUSDZwmZ/BNEKvXv+NboXfYnYEvYNaBwK9aaL\n R/JGR9BWxFT0tCu9KTa1Y7H+lu6ZOQHd0kYbSl25V60DybZAnV9SYMBvsDPc1/bxyZFB\n 4xzZVydzcJg1SHTrf18Pbbl4xAqVRKvbFffQhlz3YnOBAlz3gSsvVDEIT85DQInZ6vLA\n RXGYzHxoFh2awqhkABi19zEcHbwxoJHWDQ7h6mrFlc8muIUH07bxsNwPLbW8325M+b9U\n qTxr3juJSEDbC2Xe71uUkABbk4t1drASBygXoBRceXxuN7n6mLQseN03YlEQpZ9qBxBl\n y5jg==", "X-Gm-Message-State": "AOJu0YzehAa2U1cJ/uZlDLVZIYPlTxkEutk4B1jhcOEAeKK2S0PY3B79\n bCdG0o8H0nq6LzsyPGbGe3SmjMBZp3X6Xz90H8k3LMSSRQEyMtV1IygfDQwYpc+wV/tDqX4x4iJ\n HPjo8HZALHJ6MtXAIaGfMPjidP62SWlZO44LmGBbi/V0yE2O6wooi8zTVHI3rFl8vwwOX3V7ahC\n KIN2IaLjGhwrV6DBo9YcaTCoolHI/oAmuKfXqXog==", "X-Gm-Gg": "ATEYQzxYUh28Aqp+2zpbfzTN7FPhngWwK2GIyD/zS38essBn/TfOKofz0BWjW+7vqVx\n lieaW7UA+ucEtSWIQbNnujPsgLzA5J7VgBCPxsS25yJfoMZ8Uv+dZr4pSwCk3ZCGEEqSC/K/Pzf\n AJSCq45VGeQM0wOFiJG8YUXNJkIMH0yy20FT57m/gM94T4AO2p8zvT0ijFzhCJUK8f3L6qjkGWm\n mL9hJLjjlAGn4APS0PTzx/IugDjTsjYJnT4kHs056gi1j/eeXW0OoyRaUfvExls4oleJRArpfno\n GbQLzxSN46fjVV+MsMu26sr/LBDJVhFFH43rLvluBNPJX9sE6mWRnxw62HUNAQWeWcKQsBo6daP\n WZWNQDygBvRA=", "X-Received": [ "by 2002:a05:620a:7014:b0:8cd:982d:4122 with SMTP id\n af79cd13be357-8d0010074b7mr1097938085a.39.1774559140969;\n Thu, 26 Mar 2026 14:05:40 -0700 (PDT)", "by 2002:a05:620a:7014:b0:8cd:982d:4122 with SMTP id\n af79cd13be357-8d0010074b7mr1097931585a.39.1774559140226;\n Thu, 26 Mar 2026 14:05:40 -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>,\n Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>", "Subject": "[PATCH RFC v2 03/11] vmstate: Do not set size for\n VMS_ARRAY_OF_POINTER", "Date": "Thu, 26 Mar 2026 17:05:24 -0400", "Message-ID": "<20260326210532.379027-4-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.129.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": "When VMS_ARRAY_OF_POINTER is specified, it means the vmstate field is an\narray of pointers.\n\nThe size of the element is not relevant to whatever it is stored inside: it\nis always the host pointer size.\n\nLet's reserve the \"size\" field in this case for future use, update\nvmstate_size() so as to make it still work for array of pointers properly.\n\nWhen at this, provide rich documentation on how size / size_offset works in\nvmstate.\n\nSigned-off-by: Peter Xu <peterx@redhat.com>\nReviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>\n---\n include/migration/vmstate.h | 20 ++++++++++++++++----\n migration/savevm.c | 3 +++\n migration/vmstate.c | 10 +++++++++-\n 3 files changed, 28 insertions(+), 5 deletions(-)", "diff": "diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h\nindex 68fd954411..b4bc69486d 100644\n--- a/include/migration/vmstate.h\n+++ b/include/migration/vmstate.h\n@@ -183,11 +183,26 @@ typedef enum {\n struct VMStateField {\n const char *name;\n size_t offset;\n+\n+ /*\n+ * @size or @size_offset specifies the size of the element embeded in\n+ * the field. Only one of them should be present never both. When\n+ * @size_offset is used together with VMS_VBUFFER, it means the size is\n+ * dynamic calculated instead of a constant.\n+ *\n+ * When the field is an array of any type, this stores the size of one\n+ * element of the array.\n+ *\n+ * NOTE: even if VMS_POINTER or VMS_ARRAY_OF_POINTER may be specified,\n+ * this parameter always reflects the real size of the objects that a\n+ * pointer point to.\n+ */\n size_t size;\n+ size_t size_offset;\n+\n size_t start;\n int num;\n size_t num_offset;\n- size_t size_offset;\n const VMStateInfo *info;\n enum VMStateFlags flags;\n const VMStateDescription *vmsd;\n@@ -547,7 +562,6 @@ extern const VMStateInfo vmstate_info_qlist;\n .version_id = (_version), \\\n .num = (_num), \\\n .info = &(_info), \\\n- .size = sizeof(_type *), \\\n .flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \\\n .offset = vmstate_offset_array(_state, _field, _type*, _num), \\\n }\n@@ -557,7 +571,6 @@ extern const VMStateInfo vmstate_info_qlist;\n .version_id = (_v), \\\n .num = (_n), \\\n .vmsd = &(_vmsd), \\\n- .size = sizeof(_type *), \\\n .flags = VMS_ARRAY|VMS_STRUCT|VMS_ARRAY_OF_POINTER, \\\n .offset = vmstate_offset_array(_s, _f, _type*, _n), \\\n }\n@@ -567,7 +580,6 @@ extern const VMStateInfo vmstate_info_qlist;\n .version_id = (_version), \\\n .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \\\n .info = &(_info), \\\n- .size = sizeof(_type *), \\\n .flags = VMS_VARRAY_UINT32 | VMS_ARRAY_OF_POINTER | VMS_POINTER, \\\n .offset = vmstate_offset_pointer(_state, _field, _type *), \\\n }\ndiff --git a/migration/savevm.c b/migration/savevm.c\nindex 8115203b51..f5a6fd0c66 100644\n--- a/migration/savevm.c\n+++ b/migration/savevm.c\n@@ -868,6 +868,9 @@ static void vmstate_check(const VMStateDescription *vmsd)\n \n if (field) {\n while (field->name) {\n+ if (field->flags & VMS_ARRAY_OF_POINTER) {\n+ assert(field->size == 0);\n+ }\n if (field->flags & (VMS_STRUCT | VMS_VSTRUCT)) {\n /* Recurse to sub structures */\n vmstate_check(field->vmsd);\ndiff --git a/migration/vmstate.c b/migration/vmstate.c\nindex e98b5f5346..e29a8c3f49 100644\n--- a/migration/vmstate.c\n+++ b/migration/vmstate.c\n@@ -110,13 +110,21 @@ static int vmstate_n_elems(void *opaque, const VMStateField *field)\n \n static int vmstate_size(void *opaque, const VMStateField *field)\n {\n- int size = field->size;\n+ int size;\n \n if (field->flags & VMS_VBUFFER) {\n size = *(int32_t *)(opaque + field->size_offset);\n if (field->flags & VMS_MULTIPLY) {\n size *= field->size;\n }\n+ } else if (field->flags & VMS_ARRAY_OF_POINTER) {\n+ /*\n+ * For an array of pointer, the each element is always size of a\n+ * host pointer.\n+ */\n+ size = sizeof(void *);\n+ } else {\n+ size = field->size;\n }\n \n return size;\n", "prefixes": [ "RFC", "v2", "03/11" ] }