{"id":2227460,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2227460/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423191958.1440-27-farosas@suse.de/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/projects/14/?format=json","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-27-farosas@suse.de>","list_archive_url":null,"date":"2026-04-23T19:19:40","name":"[PULL,26/43] vmstate: Do not set size for VMS_ARRAY_OF_POINTER","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bbb59265a06afbfe2a33fe1216006a977dcf2daa","submitter":{"id":85343,"url":"http://patchwork.ozlabs.org/api/1.2/people/85343/?format=json","name":"Fabiano Rosas","email":"farosas@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260423191958.1440-27-farosas@suse.de/mbox/","series":[{"id":501236,"url":"http://patchwork.ozlabs.org/api/1.2/series/501236/?format=json","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/2227460/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2227460/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=d0ewgjhf;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=x3pVkF6e;\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=d0ewgjhf;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=x3pVkF6e;\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-out1.suse.de;\n dkim=pass header.d=suse.de header.s=susede2_rsa header.b=d0ewgjhf;\n dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=x3pVkF6e"],"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 4g1mFF5xK3z1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 05:22:25 +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 1wFzcg-0004Uz-2H; Thu, 23 Apr 2026 15:22:02 -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 1wFzcT-0003pW-OE\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 15:21:51 -0400","from smtp-out1.suse.de ([195.135.223.130])\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 1wFzcR-00029P-OT\n for qemu-devel@nongnu.org; Thu, 23 Apr 2026 15:21:49 -0400","from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org\n [IPv6:2a07:de40:b281:104: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-out1.suse.de (Postfix) with ESMTPS id 9727A6A891;\n Thu, 23 Apr 2026 19:20:40 +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 2E7FD593A3;\n Thu, 23 Apr 2026 19:20:38 +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 WIcDOwZx6mlJCwAAD6G6ig\n (envelope-from <farosas@suse.de>); Thu, 23 Apr 2026 19:20:38 +0000"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776972040;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cps/+TDf6sawK3UL3T3/BEb1DwFfw9hUVfjlHW+dVCE=;\n b=d0ewgjhfU8Ehs3zaqPzUkOn/yphPywdhWVZi/HhaSmXzYkD5Xm53Qp++Crs8lTG9c9/OE0\n aX2lzN1V/4ljESipXaKAIPuxjlyU4yiHGgvGMiy6eEKib+ghoSziO3kJ4BqA4YtXmLMiO4\n NMdOIyS1it0TNNHFI0xluOKhs5Cc+2s=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776972040;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cps/+TDf6sawK3UL3T3/BEb1DwFfw9hUVfjlHW+dVCE=;\n b=x3pVkF6eogbORMINI5+BE6oYdrUjEzF6z+xfEUuusuednmMnCFjcskF1FjNq5pfs+d1kwj\n sUNbRJJ0np4GGgDg==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776972040;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cps/+TDf6sawK3UL3T3/BEb1DwFfw9hUVfjlHW+dVCE=;\n b=d0ewgjhfU8Ehs3zaqPzUkOn/yphPywdhWVZi/HhaSmXzYkD5Xm53Qp++Crs8lTG9c9/OE0\n aX2lzN1V/4ljESipXaKAIPuxjlyU4yiHGgvGMiy6eEKib+ghoSziO3kJ4BqA4YtXmLMiO4\n NMdOIyS1it0TNNHFI0xluOKhs5Cc+2s=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776972040;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=cps/+TDf6sawK3UL3T3/BEb1DwFfw9hUVfjlHW+dVCE=;\n b=x3pVkF6eogbORMINI5+BE6oYdrUjEzF6z+xfEUuusuednmMnCFjcskF1FjNq5pfs+d1kwj\n sUNbRJJ0np4GGgDg=="],"From":"Fabiano Rosas <farosas@suse.de>","To":"qemu-devel@nongnu.org","Cc":"Peter Xu <peterx@redhat.com>,\n Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>, =?utf-8?q?Phi?=\n\t=?utf-8?q?lippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n Juraj Marcin <jmarcin@redhat.com>","Subject":"[PULL 26/43] vmstate: Do not set size for VMS_ARRAY_OF_POINTER","Date":"Thu, 23 Apr 2026 16:19:40 -0300","Message-ID":"<20260423191958.1440-27-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-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Rspamd-Action":"no action","X-Rspamd-Server":"rspamd2.dmz-prg2.suse.org","X-Spamd-Result":"default: False [-3.51 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000];\n R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[];\n FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[];\n MIME_TRACE(0.00)[0:+];\n SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from];\n RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5];\n FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[];\n RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received];\n RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,linaro.org:email];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n DKIM_TRACE(0.00)[suse.de:+]","X-Rspamd-Queue-Id":"9727A6A891","X-Spam-Score":"-3.51","Received-SPF":"pass client-ip=195.135.223.130; envelope-from=farosas@suse.de;\n helo=smtp-out1.suse.de","X-Spam_score_int":"-43","X-Spam_score":"-4.4","X-Spam_bar":"----","X-Spam_report":"(-4.4 / 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,\n RCVD_IN_DNSWL_MED=-2.3, 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: Peter Xu <peterx@redhat.com>\n\nWhen 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\nReviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@futurfusion.io>\nReviewed-by: Fabiano Rosas <farosas@suse.de>\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Peter Xu <peterx@redhat.com>\nReviewed-by: Juraj Marcin <jmarcin@redhat.com>\nLink: https://lore.kernel.org/qemu-devel/20260401202844.673494-4-peterx@redhat.com\nSigned-off-by: Fabiano Rosas <farosas@suse.de>\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 32bb8e8ebc..350e62a55a 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":["PULL","26/43"]}