From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79EE1CDB465 for ; Thu, 19 Oct 2023 20:19:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtZTr-0003CC-0i; Thu, 19 Oct 2023 16:18:56 -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 1qtZTm-00038J-PB; Thu, 19 Oct 2023 16:18:51 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtZTi-0007lv-Ub; Thu, 19 Oct 2023 16:18:49 -0400 Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39JKHEu4010423; Thu, 19 Oct 2023 20:18:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=bOJybXwM91jTNGdqWrakgu3zsqEos+EdF1ziHM2oK9c=; b=egT8+Y6obf3/6eccEtb6DLnvAuryzNzdp3NZroPJey+HuY89FCglg/2F/lDNwQ0ybIv5 gnu65Olimg0cvMqJnjIO0IJwM32lzhymOqGCgg47VNAySjZogigNVHcFyUHNt6PXXJtK uhwfwYrzKFYRZNh8FJzK0QWuRZZVEOQTeQR0hH8iZ6MgAMLXyKgvABx1/ErVxbjctD96 N5yAwV8Y1USRUFfgapc4D8D5iAqjAKw7fmrgTnmajnim8/UVnVVbUTQwogHMvkSOiqR8 XeRSCDCtj9J0B1yccmDvjlxwXdT3218MVfi9uyX+qd2ONIF7LLl4Bpt9hWkIWy3h3WS1 fA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tubc1g1js-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 20:18:23 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39JKHxiJ013256; Thu, 19 Oct 2023 20:18:22 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tubc1g1hs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 20:18:22 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39JIt5aw012949; Thu, 19 Oct 2023 20:18:21 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3tr5pyuggf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 Oct 2023 20:18:21 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39JKIK2X14090938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2023 20:18:20 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B22758058; Thu, 19 Oct 2023 20:18:20 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B9C258059; Thu, 19 Oct 2023 20:18:16 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTPS; Thu, 19 Oct 2023 20:18:16 +0000 (GMT) Message-ID: <0b5225ef-db4b-fb59-ca27-67d4111ed0a9@linux.ibm.com> Date: Thu, 19 Oct 2023 16:18:15 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 01/13] migration: Create vmstate_register_any() Content-Language: en-US To: Juan Quintela , qemu-devel@nongnu.org Cc: Stefan Berger , Marcel Apfelbaum , qemu-ppc@nongnu.org, Nicholas Piggin , qemu-s390x@nongnu.org, Gerd Hoffmann , Corey Minyard , Samuel Thibault , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Fabiano Rosas , Eric Farman , Peter Xu , Harsh Prateek Bora , John Snow , qemu-block@nongnu.org, Mark Cave-Ayland , Christian Borntraeger , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Stefan Weil , qemu-arm@nongnu.org, Jason Wang , Corey Minyard , Leonardo Bras , Thomas Huth , Peter Maydell , "Michael S. Tsirkin" , =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , David Gibson , Halil Pasic , Daniel Henrique Barboza References: <20231019190831.20363-1-quintela@redhat.com> <20231019190831.20363-2-quintela@redhat.com> From: Stefan Berger In-Reply-To: <20231019190831.20363-2-quintela@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: UBFn1tjn1sn2HOyJiG1XB7j_NNYjTqD9 X-Proofpoint-GUID: bZXnkwHhAxjKWxPPs8JK8KKkDbo-DfFE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-19_20,2023-10-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 spamscore=0 clxscore=1011 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310190173 Received-SPF: pass client-ip=148.163.156.1; envelope-from=stefanb@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -52 X-Spam_score: -5.3 X-Spam_bar: ----- X-Spam_report: (-5.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-3.339, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 10/19/23 15:08, Juan Quintela wrote: > We have lots of cases where we are using an instance_id==0 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. > > Signed-off-by: Juan Quintela Reviewed-by: Stefan Berger > --- > include/migration/vmstate.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > index 1a31fb7293..9ca7e9cc48 100644 > --- a/include/migration/vmstate.h > +++ b/include/migration/vmstate.h > @@ -1230,6 +1230,23 @@ static inline int vmstate_register(VMStateIf *obj, int instance_id, > opaque, -1, 0, NULL); > } > > +/** > + * 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, vmsd, > + opaque, -1, 0, NULL); > +} > + > void vmstate_unregister(VMStateIf *obj, const VMStateDescription *vmsd, > void *opaque); >