From nobody Tue Feb 10 21:41:38 2026 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1698153721; cv=none; d=zohomail.com; s=zohoarc; b=axXmdmaSRSoFYTTmNTpzlwgOGcAVPnicfg9yX/EFDx4spDTcyovBG4Fe1LQLPPUI3kZD6ldw7TX57Evb2G5QJxzKl477t9ZZrHafcbkYnkuyfApR/Nc8E4spE1YoHiNkGqNnZE+5jvxeUKrhNj/PqMP2BFQ5khrTvMu7XdXloZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698153721; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XdFHJUBuMGnAWFqd7hEgg2x2gUonHhaiV5RCE6MlQuA=; b=U9VTgidCgs8SLmBl/qEUZR+fE+CYxmJxWhz74apdZvo48CDWCMGUTNFZRTlFg6nx2tsehgZTJd/3MlPbuidRJKFMpU5PYxjyQaJ0cso5zSMdDMk63ZBcSyCxjvySrjkOh0n8Nx8xmPVpvrv6+YURCVsu0T1Hu/Jkhfg5xm0dVEU= 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+importer2=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 1698153721438910.0725872789096; Tue, 24 Oct 2023 06:22:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvHI3-0005zZ-Kr; Tue, 24 Oct 2023 09:17:49 -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 1qvHGf-0002wB-F7 for qemu-devel@nongnu.org; Tue, 24 Oct 2023 09:16:21 -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 1qvHGb-0001wH-Pd for qemu-devel@nongnu.org; Tue, 24 Oct 2023 09:16:21 -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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-342-zK0mN5RGOHOy7FeMXq-BIQ-1; Tue, 24 Oct 2023 09:16:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 319E08164E8; Tue, 24 Oct 2023 13:16:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71E1A1C060AE; Tue, 24 Oct 2023 13:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698153377; 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=XdFHJUBuMGnAWFqd7hEgg2x2gUonHhaiV5RCE6MlQuA=; b=hmRElxcKjQGAbKq0+QZkjLKhZHsUFTXPUucsGXmW4aoqdJVbJQB8ej/Sj4GsH6fkCUH/Fl OVyzJRepDzg4ulRV0nZAmVlHatncyEOnRUYnuw+2LV5xeCVITgq5JDie6QEYDtW7uxVzU+ YdLLbKRMKGEf/sEZhtUNToMwASTC9CQ= X-MC-Unique: zK0mN5RGOHOy7FeMXq-BIQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Eric Blake , Richard Henderson , Corey Minyard , Li Zhijian , Marcel Apfelbaum , Hanna Reitz , John Snow , David Gibson , Gerd Hoffmann , Stefan Hajnoczi , Halil Pasic , Peter Maydell , Corey Minyard , Mark Cave-Ayland , Kevin Wolf , qemu-s390x@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-arm@nongnu.org, libvir-list@redhat.com, Stefan Weil , Nicholas Piggin , Daniel Henrique Barboza , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Xu , Leonardo Bras , Jason Wang , Fam Zheng , Christian Borntraeger , David Hildenbrand , Thomas Huth , Fabiano Rosas , Ilya Leoshkevich , Harsh Prateek Bora , Samuel Thibault , Eric Farman , Juan Quintela , Markus Armbruster , Stefan Berger , qemu-ppc@nongnu.org, "Michael S. Tsirkin" , qemu-block@nongnu.org, Stefan Berger Subject: [PULL 25/39] migration: Create vmstate_register_any() Date: Tue, 24 Oct 2023 15:12:51 +0200 Message-ID: <20231024131305.87468-26-quintela@redhat.com> In-Reply-To: <20231024131305.87468-1-quintela@redhat.com> References: <20231024131305.87468-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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+importer2=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: -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, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1698153723293100005 Content-Type: text/plain; charset="utf-8" We have lots of cases where we are using an instance_id=3D=3D0 when we should be using VMSTATE_INSTANCE_ID_ANY (-1). Basically everything that can have more than one needs to have a proper instance_id or -1 and the system will take one for it. vmstate_register_any(): We register with -1. Reviewed-by: Stefan Berger Signed-off-by: Juan Quintela Message-ID: <20231020090731.28701-2-quintela@redhat.com> --- include/migration/vmstate.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 1af181877c..1ea97ccf2d 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1230,6 +1230,23 @@ static inline int vmstate_register(VMStateIf *obj, i= nt instance_id, opaque, -1, 0, NULL); } =20 +/** + * vmstate_register_any() - legacy function to register state + * serialisation description and let the function choose the id + * + * New code shouldn't be using this function as QOM-ified devices have + * dc->vmsd to store the serialisation description. + * + * Returns: 0 on success, -1 on failure + */ +static inline int vmstate_register_any(VMStateIf *obj, + const VMStateDescription *vmsd, + void *opaque) +{ + return vmstate_register_with_alias_id(obj, VMSTATE_INSTANCE_ID_ANY, vm= sd, + opaque, -1, 0, NULL); +} + void vmstate_unregister(VMStateIf *obj, const VMStateDescription *vmsd, void *opaque); =20 --=20 2.41.0