From nobody Mon Feb 9 02:42:34 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682584051; cv=none; d=zohomail.com; s=zohoarc; b=Ozr/6ayatazVlJlbpBM5a8+773gYSUknEWfxemphmUAgeIrV74cIwYECYnV2TDhBnv89FQlZrstZd2enKhnMRhiSNujDgw8ZOUJzmkUV6P0LOGPYvnfE+gIzyDCXehSd8WmExX+17/w43oOgMhjrRUt6VuRxDEQduszK68/R7JE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682584051; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7hpFxDZgTL4tlOiN3Iw3xMAXDUUXTaaX8jXP0Fljze0=; b=fxG+Dy5KQjg40BV9CwPndbti2Vub8/wh+iTN51NmyF3x2rqkCf7ChDyD0O+KGGniADHvqnfiRWucjZB3gSuFYL17nEYQ4jTC5dd/dh748VCO2IsBxlhaVdghC2xx7fv+hv1n99XnVjb+mxiNSy3CGUEI4Sqljm5c2Ba5aRtt4LA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682584051976710.5824709884827; Thu, 27 Apr 2023 01:27:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prwxE-0001Kh-93; Thu, 27 Apr 2023 04:26:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prwxC-0001Jx-OT for qemu-devel@nongnu.org; Thu, 27 Apr 2023 04:26:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prwxB-0001GP-8u for qemu-devel@nongnu.org; Thu, 27 Apr 2023 04:26:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-MgNjEPJDPNeWljJ2yLuwhw-1; Thu, 27 Apr 2023 04:26:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DAB485A588 for ; Thu, 27 Apr 2023 08:26:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F661C15BA0; Thu, 27 Apr 2023 08:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682583971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7hpFxDZgTL4tlOiN3Iw3xMAXDUUXTaaX8jXP0Fljze0=; b=DVr0b5Eeuwsy1p7J5DovHr2TA+hPIZ9XilI0R40/6oPA7CvBZ7b6bqyD9vT0MPSqfGKp32 K1QYlV5tLWY77Y0I10k5fUZYDS782DtRnUtzOtRjpHz3Nsex+6D1h2Z46TYqEdEGFh5gG8 SbiXkBmw/UphMAR1eZhJogGh7Yjkerk= X-MC-Unique: MgNjEPJDPNeWljJ2yLuwhw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: John Snow , Juan Quintela , Cleber Rosa , Peter Xu , Leonardo Bras Subject: [PULL 6/7] migration/vmstate-dump: Dump array size too as "num" Date: Thu, 27 Apr 2023 10:25:56 +0200 Message-Id: <20230427082557.20994-7-quintela@redhat.com> In-Reply-To: <20230427082557.20994-1-quintela@redhat.com> References: <20230427082557.20994-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682584052463100001 Content-Type: text/plain; charset="utf-8" From: Peter Xu For VMS_ARRAY typed vmsd fields, also dump the number of entries in the array in -vmstate-dump. Without such information, vmstate static checker can report false negatives of incompatible vmsd on VMS_ARRAY typed fields, when the src/dst do not have the same type of array defined. It's because in the checker we only check against size of fields within a VMSD field. One example: e1000e used to have a field defined as a boolean array with 5 entries, then removed it and replaced it with UNUSED (in 31e3f318c8b535): - VMSTATE_BOOL_ARRAY(core.eitr_intr_pending, E1000EState, - E1000E_MSIX_VEC_NUM), + VMSTATE_UNUSED(E1000E_MSIX_VEC_NUM), It's a legal replacement but vmstate static checker is not happy with it, because it checks only against the "size" field between the two fields (here one is BOOL_ARRAY, the other is UNUSED): For BOOL_ARRAY: { "field": "core.eitr_intr_pending", "version_id": 0, "field_exists": false, "size": 1 }, For UNUSED: { "field": "unused", "version_id": 0, "field_exists": false, "size": 5 }, It's not the script to blame because there's just not enough information dumped to show the total size of the entry for an array. Add it. Note that this will not break old vmstate checker because the field will just be ignored. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/savevm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migration/savevm.c b/migration/savevm.c index 211eff3a8b..a9181b444b 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -536,6 +536,9 @@ static void dump_vmstate_vmsf(FILE *out_file, const VMS= tateField *field, field->version_id); fprintf(out_file, "%*s\"field_exists\": %s,\n", indent, "", field->field_exists ? "true" : "false"); + if (field->flags & VMS_ARRAY) { + fprintf(out_file, "%*s\"num\": %d,\n", indent, "", field->num); + } fprintf(out_file, "%*s\"size\": %zu", indent, "", field->size); if (field->vmsd !=3D NULL) { fprintf(out_file, ",\n"); --=20 2.40.0