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 8D980C83F1A for ; Mon, 21 Jul 2025 12:33:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1udph0-0001oz-3i; Mon, 21 Jul 2025 08:32:30 -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 1udpgg-0001GU-PS for qemu-devel@nongnu.org; Mon, 21 Jul 2025 08:32:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1udpgb-0002Wz-NK for qemu-devel@nongnu.org; Mon, 21 Jul 2025 08:32:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753101122; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GLOA7ySF2Gn6po3KzRxtNtZJ8uCRDJh5d0d3ZLp/BHw=; b=NqPqcuPVQs2Uta5I+H3EJecHWNclmOhOIvVhmmYyd+4At7LwNDH88zDZ+Ou9Qd61DgyELG WbJWb6WtNbmTTofBvISE99wofk5yxRte8FOEzoRX9mFsQTO8WkgevGX2RSWovRXBU6Rg2U 62FmtCnxU5+uvRyJmKc877HZ7zcvhIg= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-339-NMmo1Z3sNK-6HMPLU5n_iw-1; Mon, 21 Jul 2025 08:30:50 -0400 X-MC-Unique: NMmo1Z3sNK-6HMPLU5n_iw-1 X-Mimecast-MFC-AGG-ID: NMmo1Z3sNK-6HMPLU5n_iw_1753101050 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-311ae2b6647so4008159a91.0 for ; Mon, 21 Jul 2025 05:30:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753101049; x=1753705849; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GLOA7ySF2Gn6po3KzRxtNtZJ8uCRDJh5d0d3ZLp/BHw=; b=MV+gEFK7puEFMuFzd6Fd66UE9mq9A5jpPfH7h1xB/sZYetOxduRtdjYHv/DkhnDArQ fGHXZnO2eBI9LWWB0GoYdrxjCDjUwHV9rOrRl82G1dYldN1dYbOmKb3ctwqgncBnZf/h 2Rf1s4OVV95bz7/6eEeJZVDt+U91FC/U01XoL/kX3h9fxJfzkxMSiAKHbO3iTgVuXDjs BRzzjC6IjKhz1bHt3qM9CBbDm6GxdIIbEO0XBXO6PTd+DrQmkFyHKOMlLPNKZCj1Vol+ VTvGgSxvkQ1MfNqiR7Jc7r+kH/mbWDmjoNyUkPXcFutElzr6Qc2u/GdUcPgkzp3/Zy3W LUow== X-Gm-Message-State: AOJu0Yy9BN1QyLiHwTjXnsVNEsChFdPzh+KAK/R4C9qSBVqnA7qukava gen31ws5oVfGNhNsNJyixUwvqzD7qW1gNtA+8X7O7W4RmHNzjKwWSZejSf5zDAE5E3yu8UxfHn1 6Y/gfusWdKdxG28q/Dk96FDbxTgunM+IwDVy1Sr26cGO3jUQGEp3HVWjlEUqSerDKCXTPgTJqZ4 k5yUYc/J3760J4gEwCv2Que/YjjC1zTmQ= X-Gm-Gg: ASbGncsqU7CKDCPvh8EaHUD41rt46jCjzV5DZEf9mNm7FAtXwZYHVmm6syuVu1zt5/g zoeI87GQaiS+4pfaYsDVZx3Ld6Uum+4yBLSWtTiyz+C8Is3Kk40n/Yd5bujLh5cdz8uv6pPV3Zg wFJG+4qskp8tzIVgBmwlA/y9q6n43HtpwU6RhBCsAULOIEYi7/cL/Uvg== X-Received: by 2002:a17:90b:562b:b0:313:2206:adf1 with SMTP id 98e67ed59e1d1-31cc2515fdemr17104788a91.4.1753101049247; Mon, 21 Jul 2025 05:30:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+Zc1aEe5AcQ1JAqWhIb1zZgIiFqLTpYBn/MOBiOOCVAAHx0ktqzxLzxA+Kq0BQDAGqsi/jqATXGC6lXyzXhg= X-Received: by 2002:a17:90b:562b:b0:313:2206:adf1 with SMTP id 98e67ed59e1d1-31cc2515fdemr17104753a91.4.1753101048660; Mon, 21 Jul 2025 05:30:48 -0700 (PDT) MIME-Version: 1.0 References: <20250721-propagate_tpm_error-v6-0-fef740e15e17@redhat.com> <20250721-propagate_tpm_error-v6-2-fef740e15e17@redhat.com> In-Reply-To: <20250721-propagate_tpm_error-v6-2-fef740e15e17@redhat.com> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Mon, 21 Jul 2025 16:30:36 +0400 X-Gm-Features: Ac12FXzLgAeI74iZuxzY4IYIvSEUplwpMTwcp_JU3SF-eyUR86lfUtN275DHa4E Message-ID: Subject: Re: [PATCH v6 02/24] migration: push Error **errp into vmstate_load_state() To: Arun Menon , "Armbruster, Markus" Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" , Marcel Apfelbaum , Cornelia Huck , Halil Pasic , Eric Farman , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Thomas Huth , Christian Borntraeger , Paolo Bonzini , Fam Zheng , Nicholas Piggin , Daniel Henrique Barboza , Harsh Prateek Bora , Alex Williamson , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , Peter Xu , Fabiano Rosas , Hailiang Zhang , Steve Sistare , qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, Stefan Berger , =?UTF-8?B?QWxleCBCZW5uw6ll?= , Akihiko Odaki , Dmitry Osipenko , Matthew Rosato Content-Type: multipart/alternative; boundary="00000000000042e775063a6fa5a3" Received-SPF: pass client-ip=170.10.129.124; envelope-from=mlureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.926, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 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 --00000000000042e775063a6fa5a3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Mon, Jul 21, 2025 at 3:35=E2=80=AFPM Arun Menon wro= te: > This is an incremental step in converting vmstate loading > code to report error via Error objects instead of directly > printing it to console/monitor. > It is ensured that vmstate_load_state() must report an error > in errp, in case of failure. > > Signed-off-by: Arun Menon > --- > hw/display/virtio-gpu.c | 2 +- > hw/pci/pci.c | 2 +- > hw/s390x/virtio-ccw.c | 2 +- > hw/scsi/spapr_vscsi.c | 2 +- > hw/vfio/pci.c | 2 +- > hw/virtio/virtio-mmio.c | 2 +- > hw/virtio/virtio-pci.c | 2 +- > hw/virtio/virtio.c | 4 ++-- > include/migration/vmstate.h | 2 +- > migration/cpr.c | 4 ++-- > migration/savevm.c | 6 ++++-- > migration/vmstate-types.c | 10 +++++----- > migration/vmstate.c | 45 > ++++++++++++++++++++++++++++----------------- > tests/unit/test-vmstate.c | 18 +++++++++--------- > ui/vdagent.c | 2 +- > 15 files changed, 59 insertions(+), 46 deletions(-) > > diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c > index > 0a1a625b0ea6cf26cb0d799171a57ed3d3ab2442..5d2ca8d8b864350133a674802d7316a= bd379591c > 100644 > --- a/hw/display/virtio-gpu.c > +++ b/hw/display/virtio-gpu.c > @@ -1343,7 +1343,7 @@ static int virtio_gpu_load(QEMUFile *f, void > *opaque, size_t size, > } > > /* load & apply scanout state */ > - vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1); > + vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1, NULL); > > return 0; > } > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > index > c70b5ceebaf1f2b10768bd030526cbb518da2b8d..2ab5d30bb3c319ac1c7bfc9a2acf6a2= b38082066 > 100644 > --- a/hw/pci/pci.c > +++ b/hw/pci/pci.c > @@ -934,7 +934,7 @@ void pci_device_save(PCIDevice *s, QEMUFile *f) > int pci_device_load(PCIDevice *s, QEMUFile *f) > { > int ret; > - ret =3D vmstate_load_state(f, &vmstate_pci_device, s, s->version_id)= ; > + ret =3D vmstate_load_state(f, &vmstate_pci_device, s, s->version_id, > NULL); > /* Restore the interrupt status bit. */ > pci_update_irq_status(s); > return ret; > diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c > index > d2f85b39f30f7fc82e0c600144c0a958e1269b2c..2f6feff2b0a22d7d7f6aecfd7e7870d= 8362f1a73 > 100644 > --- a/hw/s390x/virtio-ccw.c > +++ b/hw/s390x/virtio-ccw.c > @@ -1136,7 +1136,7 @@ static void virtio_ccw_save_config(DeviceState *d, > QEMUFile *f) > static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f) > { > VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d); > - return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1); > + return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1, NULL); > } > > static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp) > diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c > index > 20f70fb2729de78b9636a6b8c869695dab4f8902..573fdea668536b464bca11f001e9e02= 88e781493 > 100644 > --- a/hw/scsi/spapr_vscsi.c > +++ b/hw/scsi/spapr_vscsi.c > @@ -648,7 +648,7 @@ static void *vscsi_load_request(QEMUFile *f, > SCSIRequest *sreq) > assert(!req->active); > > memset(req, 0, sizeof(*req)); > - rc =3D vmstate_load_state(f, &vmstate_spapr_vscsi_req, req, 1); > + rc =3D vmstate_load_state(f, &vmstate_spapr_vscsi_req, req, 1, NULL)= ; > if (rc) { > fprintf(stderr, "VSCSI: failed loading request tag#%u\n", > sreq->tag); > return NULL; > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index > be05002b9819fafa45cf2fb4d2a0acdc475c558c..f8ce4a40dbe4c070a0d6c111051051e= e97542719 > 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -2797,7 +2797,7 @@ static int vfio_pci_load_config(VFIODevice > *vbasedev, QEMUFile *f) > old_addr[bar] =3D pdev->io_regions[bar].addr; > } > > - ret =3D vmstate_load_state(f, &vmstate_vfio_pci_config, vdev, 1); > + ret =3D vmstate_load_state(f, &vmstate_vfio_pci_config, vdev, 1, NUL= L); > if (ret) { > return ret; > } > diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c > index > 532c67107ba1d2978a76cf49f9cdc1de1dea3e11..9058b1563462d4464dcba799643a583= c93fb5683 > 100644 > --- a/hw/virtio/virtio-mmio.c > +++ b/hw/virtio/virtio-mmio.c > @@ -619,7 +619,7 @@ static int virtio_mmio_load_extra_state(DeviceState > *opaque, QEMUFile *f) > { > VirtIOMMIOProxy *proxy =3D VIRTIO_MMIO(opaque); > > - return vmstate_load_state(f, &vmstate_virtio_mmio, proxy, 1); > + return vmstate_load_state(f, &vmstate_virtio_mmio, proxy, 1, NULL); > } > > static bool virtio_mmio_has_extra_state(DeviceState *opaque) > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index > 767216d795998708f5716a23ae16c79cd90ff489..f8b52a611e56c22d844fd4cae3619da= 4f2686d03 > 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -161,7 +161,7 @@ static int virtio_pci_load_extra_state(DeviceState *d= , > QEMUFile *f) > { > VirtIOPCIProxy *proxy =3D to_virtio_pci_proxy(d); > > - return vmstate_load_state(f, &vmstate_virtio_pci, proxy, 1); > + return vmstate_load_state(f, &vmstate_virtio_pci, proxy, 1, NULL); > } > > static void virtio_pci_save_queue(DeviceState *d, int n, QEMUFile *f) > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > index > 2ab1d20769495ea39445b87e3673b076ad172510..d5698b062a1e95437f6113f41136e90= ae06f1974 > 100644 > --- a/hw/virtio/virtio.c > +++ b/hw/virtio/virtio.c > @@ -3317,14 +3317,14 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int > version_id) > } > > if (vdc->vmsd) { > - ret =3D vmstate_load_state(f, vdc->vmsd, vdev, version_id); > + ret =3D vmstate_load_state(f, vdc->vmsd, vdev, version_id, NULL)= ; > if (ret) { > return ret; > } > } > > /* Subsections */ > - ret =3D vmstate_load_state(f, &vmstate_virtio, vdev, 1); > + ret =3D vmstate_load_state(f, &vmstate_virtio, vdev, 1, NULL); > if (ret) { > return ret; > } > diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h > index > 1ff7bd9ac425ba67cd5ca7ad97bcf570f9e19abe..056781b1c21e737583f081594d9f88b= 32adfd674 > 100644 > --- a/include/migration/vmstate.h > +++ b/include/migration/vmstate.h > @@ -1196,7 +1196,7 @@ extern const VMStateInfo vmstate_info_qlist; > } > > int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, > - void *opaque, int version_id); > + void *opaque, int version_id, Error **errp); > int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, > void *opaque, JSONWriter *vmdesc); > int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription > *vmsd, > diff --git a/migration/cpr.c b/migration/cpr.c > index > 42ad0b0d500e5de57faf0c6517e216b2d1c0cacf..74fac9521717ec568d14dabcbcb574b= 19fc1da67 > 100644 > --- a/migration/cpr.c > +++ b/migration/cpr.c > @@ -233,9 +233,9 @@ int cpr_state_load(MigrationChannel *channel, Error > **errp) > return -ENOTSUP; > } > > - ret =3D vmstate_load_state(f, &vmstate_cpr_state, &cpr_state, 1); > + ret =3D vmstate_load_state(f, &vmstate_cpr_state, &cpr_state, 1, err= p); > if (ret) { > - error_setg(errp, "vmstate_load_state error %d", ret); > + error_prepend(errp, "vmstate_load_state error %d ", ret); > Although it's not enforced, I think it's recommended to end the error_prepend() string with ": ", not just a space. > qemu_fclose(f); > return ret; > } > diff --git a/migration/savevm.c b/migration/savevm.c > index > fabbeb296ae987d0c06ba6dafda63720205fecfd..ab947620f724874f325fb9fb59bef50= b7c16fb51 > 100644 > --- a/migration/savevm.c > +++ b/migration/savevm.c > @@ -969,7 +969,8 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry > *se) > if (!se->vmsd) { /* Old style */ > return se->ops->load_state(f, se->opaque, se->load_version_id); > } > - return vmstate_load_state(f, se->vmsd, se->opaque, > se->load_version_id); > + return vmstate_load_state(f, se->vmsd, se->opaque, > se->load_version_id, > + NULL); > } > > static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, > @@ -2839,7 +2840,8 @@ static int qemu_loadvm_state_header(QEMUFile *f) > error_report("Configuration section missing"); > return -EINVAL; > } > - ret =3D vmstate_load_state(f, &vmstate_configuration, > &savevm_state, 0); > + ret =3D vmstate_load_state(f, &vmstate_configuration, > &savevm_state, 0, > + NULL); > > if (ret) { > return ret; > diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c > index > 741a588b7e18c6d37724b08a0101edc8bc74a0a5..1c5b76e1dd198030847971bc3563786= 7c9d54fc0 > 100644 > --- a/migration/vmstate-types.c > +++ b/migration/vmstate-types.c > @@ -549,7 +549,7 @@ static int get_tmp(QEMUFile *f, void *pv, size_t size= , > > /* Writes the parent field which is at the start of the tmp */ > *(void **)tmp =3D pv; > - ret =3D vmstate_load_state(f, vmsd, tmp, version_id); > + ret =3D vmstate_load_state(f, vmsd, tmp, version_id, NULL); > g_free(tmp); > return ret; > } > @@ -649,7 +649,7 @@ static int get_qtailq(QEMUFile *f, void *pv, size_t > unused_size, > > while (qemu_get_byte(f)) { > elm =3D g_malloc(size); > - ret =3D vmstate_load_state(f, vmsd, elm, version_id); > + ret =3D vmstate_load_state(f, vmsd, elm, version_id, NULL); > if (ret) { > return ret; > } > @@ -803,7 +803,7 @@ static int get_gtree(QEMUFile *f, void *pv, size_t > unused_size, > key =3D (void *)(uintptr_t)qemu_get_be64(f); > } else { > key =3D g_malloc0(key_size); > - ret =3D vmstate_load_state(f, key_vmsd, key, version_id); > + ret =3D vmstate_load_state(f, key_vmsd, key, version_id, NUL= L); > if (ret) { > error_report("%s : failed to load %s (%d)", > field->name, key_vmsd->name, ret); > @@ -811,7 +811,7 @@ static int get_gtree(QEMUFile *f, void *pv, size_t > unused_size, > } > } > val =3D g_malloc0(val_size); > - ret =3D vmstate_load_state(f, val_vmsd, val, version_id); > + ret =3D vmstate_load_state(f, val_vmsd, val, version_id, NULL); > if (ret) { > error_report("%s : failed to load %s (%d)", > field->name, val_vmsd->name, ret); > @@ -892,7 +892,7 @@ static int get_qlist(QEMUFile *f, void *pv, size_t > unused_size, > > while (qemu_get_byte(f)) { > elm =3D g_malloc(size); > - ret =3D vmstate_load_state(f, vmsd, elm, version_id); > + ret =3D vmstate_load_state(f, vmsd, elm, version_id, NULL); > if (ret) { > error_report("%s: failed to load %s (%d)", field->name, > vmsd->name, ret); > diff --git a/migration/vmstate.c b/migration/vmstate.c > index > 129b19d7603a0ddf8ab6e946e41c1c4d773d1fa8..288b57e1ed778cce21247b64d5e97df= ef41ad586 > 100644 > --- a/migration/vmstate.c > +++ b/migration/vmstate.c > @@ -132,29 +132,33 @@ static void vmstate_handle_alloc(void *ptr, const > VMStateField *field, > } > > int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, > - void *opaque, int version_id) > + void *opaque, int version_id, Error **errp) > { > const VMStateField *field =3D vmsd->fields; > int ret =3D 0; > > trace_vmstate_load_state(vmsd->name, version_id); > if (version_id > vmsd->version_id) { > - error_report("%s: incoming version_id %d is too new " > - "for local version_id %d", > - vmsd->name, version_id, vmsd->version_id); > + error_setg(errp, "%s: incoming version_id %d is too new " > + "for local version_id %d", > + vmsd->name, version_id, vmsd->version_id); > trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL); > return -EINVAL; > } > if (version_id < vmsd->minimum_version_id) { > - error_report("%s: incoming version_id %d is too old " > - "for local minimum version_id %d", > - vmsd->name, version_id, vmsd->minimum_version_id); > + error_setg(errp, "%s: incoming version_id %d is too old " > + "for local minimum version_id %d", > + vmsd->name, version_id, vmsd->minimum_version_id); > trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL); > return -EINVAL; > } > if (vmsd->pre_load) { > ret =3D vmsd->pre_load(opaque); > if (ret) { > + error_setg(errp, "VM pre load failed for: '%s', " > + "version_id: '%d', minimum version_id: '%d', ret: > %d", > + vmsd->name, vmsd->version_id, > vmsd->minimum_version_id, > + ret); > return ret; > } > } > @@ -192,10 +196,12 @@ int vmstate_load_state(QEMUFile *f, const > VMStateDescription *vmsd, > > if (inner_field->flags & VMS_STRUCT) { > ret =3D vmstate_load_state(f, inner_field->vmsd, > curr_elem, > - > inner_field->vmsd->version_id); > + > inner_field->vmsd->version_id, > + errp); > } else if (inner_field->flags & VMS_VSTRUCT) { > ret =3D vmstate_load_state(f, inner_field->vmsd, > curr_elem, > - > inner_field->struct_version_id); > + > inner_field->struct_version_id, > + errp); > } else { > ret =3D inner_field->info->get(f, curr_elem, size, > inner_field); > @@ -211,27 +217,32 @@ int vmstate_load_state(QEMUFile *f, const > VMStateDescription *vmsd, > } > if (ret < 0) { > qemu_file_set_error(f, ret); > - error_report("Failed to load %s:%s", vmsd->name, > - field->name); > + error_prepend(errp, "Failed to load %s:%s version_id= : > %d ", > + vmsd->name, field->name, > vmsd->version_id); > trace_vmstate_load_field_error(field->name, ret); > return ret; > } > } > } else if (field->flags & VMS_MUST_EXIST) { > - error_report("Input validation failed: %s/%s", > - vmsd->name, field->name); > + error_setg(errp, "Input validation failed: %s/%s version_id: > %d", > + vmsd->name, field->name, vmsd->version_id); > return -1; > } > field++; > } > assert(field->flags =3D=3D VMS_END); > - ret =3D vmstate_subsection_load(f, vmsd, opaque, NULL); > + ret =3D vmstate_subsection_load(f, vmsd, opaque, errp); > if (ret !=3D 0) { > qemu_file_set_error(f, ret); > return ret; > } > if (vmsd->post_load) { > ret =3D vmsd->post_load(opaque, version_id); > + if (ret < 0) { > + error_setg(errp, "VM Post load failed for: %s, version_id: > %d," > + "minimum_version: %d, ret: %d", vmsd->name, > + vmsd->version_id, vmsd->minimum_version_id, ret); > + } > } > trace_vmstate_load_state_end(vmsd->name, "end", ret); > return ret; > @@ -607,11 +618,11 @@ static int vmstate_subsection_load(QEMUFile *f, > const VMStateDescription *vmsd, > qemu_file_skip(f, len); /* idstr */ > version_id =3D qemu_get_be32(f); > > - ret =3D vmstate_load_state(f, sub_vmsd, opaque, version_id); > + ret =3D vmstate_load_state(f, sub_vmsd, opaque, version_id, errp= ); > if (ret) { > trace_vmstate_subsection_load_bad(vmsd->name, idstr, > "(child)"); > - error_setg(errp, "Loading VM subsection '%s' in '%s' failed = : > %d", > - idstr, vmsd->name, ret); > + error_prepend(errp, "Loading VM subsection '%s'" > + "in '%s' failed : %d ", idstr, vmsd->name, ret= ); > return ret; > } > } > diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c > index > 63f28f26f45691a70936d33e7341d16477a3471f..ca5e0ba1e3e5e2bb0a1ce39143a292f= 2c6f9420a > 100644 > --- a/tests/unit/test-vmstate.c > +++ b/tests/unit/test-vmstate.c > @@ -114,7 +114,7 @@ static int load_vmstate_one(const VMStateDescription > *desc, void *obj, > qemu_fclose(f); > > f =3D open_test_file(false); > - ret =3D vmstate_load_state(f, desc, obj, version); > + ret =3D vmstate_load_state(f, desc, obj, version, NULL); > if (ret) { > g_assert(qemu_file_get_error(f)); > } else{ > @@ -365,7 +365,7 @@ static void test_load_v1(void) > > QEMUFile *loading =3D open_test_file(false); > TestStruct obj =3D { .b =3D 200, .e =3D 500, .f =3D 600 }; > - vmstate_load_state(loading, &vmstate_versioned, &obj, 1); > + vmstate_load_state(loading, &vmstate_versioned, &obj, 1, NULL); > g_assert(!qemu_file_get_error(loading)); > g_assert_cmpint(obj.a, =3D=3D, 10); > g_assert_cmpint(obj.b, =3D=3D, 200); > @@ -391,7 +391,7 @@ static void test_load_v2(void) > > QEMUFile *loading =3D open_test_file(false); > TestStruct obj; > - vmstate_load_state(loading, &vmstate_versioned, &obj, 2); > + vmstate_load_state(loading, &vmstate_versioned, &obj, 2, NULL); > g_assert_cmpint(obj.a, =3D=3D, 10); > g_assert_cmpint(obj.b, =3D=3D, 20); > g_assert_cmpint(obj.c, =3D=3D, 30); > @@ -480,7 +480,7 @@ static void test_load_noskip(void) > > QEMUFile *loading =3D open_test_file(false); > TestStruct obj =3D { .skip_c_e =3D false }; > - vmstate_load_state(loading, &vmstate_skipping, &obj, 2); > + vmstate_load_state(loading, &vmstate_skipping, &obj, 2, NULL); > g_assert(!qemu_file_get_error(loading)); > g_assert_cmpint(obj.a, =3D=3D, 10); > g_assert_cmpint(obj.b, =3D=3D, 20); > @@ -504,7 +504,7 @@ static void test_load_skip(void) > > QEMUFile *loading =3D open_test_file(false); > TestStruct obj =3D { .skip_c_e =3D true, .c =3D 300, .e =3D 500 }; > - vmstate_load_state(loading, &vmstate_skipping, &obj, 2); > + vmstate_load_state(loading, &vmstate_skipping, &obj, 2, NULL); > g_assert(!qemu_file_get_error(loading)); > g_assert_cmpint(obj.a, =3D=3D, 10); > g_assert_cmpint(obj.b, =3D=3D, 20); > @@ -773,7 +773,7 @@ static void test_load_q(void) > TestQtailq tgt; > > QTAILQ_INIT(&tgt.q); > - vmstate_load_state(fload, &vmstate_q, &tgt, 1); > + vmstate_load_state(fload, &vmstate_q, &tgt, 1, NULL); > char eof =3D qemu_get_byte(fload); > g_assert(!qemu_file_get_error(fload)); > g_assert_cmpint(tgt.i16, =3D=3D, obj_q.i16); > @@ -1127,7 +1127,7 @@ static void test_gtree_load_domain(void) > > fload =3D open_test_file(false); > > - vmstate_load_state(fload, &vmstate_domain, dest_domain, 1); > + vmstate_load_state(fload, &vmstate_domain, dest_domain, 1, NULL); > eof =3D qemu_get_byte(fload); > g_assert(!qemu_file_get_error(fload)); > g_assert_cmpint(orig_domain->id, =3D=3D, dest_domain->id); > @@ -1241,7 +1241,7 @@ static void test_gtree_load_iommu(void) > qemu_fclose(fsave); > > fload =3D open_test_file(false); > - vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1); > + vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1, NULL); > eof =3D qemu_get_byte(fload); > g_assert(!qemu_file_get_error(fload)); > g_assert_cmpint(orig_iommu->id, =3D=3D, dest_iommu->id); > @@ -1376,7 +1376,7 @@ static void test_load_qlist(void) > qemu_fclose(fsave); > > fload =3D open_test_file(false); > - vmstate_load_state(fload, &vmstate_container, dest_container, 1); > + vmstate_load_state(fload, &vmstate_container, dest_container, 1, > NULL); > eof =3D qemu_get_byte(fload); > g_assert(!qemu_file_get_error(fload)); > g_assert_cmpint(eof, =3D=3D, QEMU_VM_EOF); > diff --git a/ui/vdagent.c b/ui/vdagent.c > index > c0746fe5b168fdc7aeb4866de2ba0c3387566649..83457dee0767433ad0778b37b41b9c6= 73a0e1860 > 100644 > --- a/ui/vdagent.c > +++ b/ui/vdagent.c > @@ -1008,7 +1008,7 @@ static int get_cbinfo(QEMUFile *f, void *pv, size_t > size, > > vdagent_clipboard_peer_register(vd); > > - ret =3D vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0); > + ret =3D vmstate_load_state(f, &vmstate_cbinfo_array, &cbinfo, 0, NUL= L); > if (ret) { > return ret; > } > > -- > 2.50.0 > > --00000000000042e775063a6fa5a3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Mon, Jul 21, 2= 025 at 3:35=E2=80=AFPM Arun Menon <armenon@redhat.com> wrote:
This is an incremental step in converting vmstate loadin= g
code to report error via Error objects instead of directly
printing it to console/monitor.
It is ensured that vmstate_load_state() must report an error
in errp, in case of failure.

Signed-off-by: Arun Menon <armenon@redhat.com>
---
=C2=A0hw/display/virtio-gpu.c=C2=A0 =C2=A0 =C2=A0|=C2=A0 2 +-
=C2=A0hw/pci/pci.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |= =C2=A0 2 +-
=C2=A0hw/s390x/virtio-ccw.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 2 +-
=C2=A0hw/scsi/spapr_vscsi.c=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 2 +-
=C2=A0hw/vfio/pci.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|= =C2=A0 2 +-
=C2=A0hw/virtio/virtio-mmio.c=C2=A0 =C2=A0 =C2=A0|=C2=A0 2 +-
=C2=A0hw/virtio/virtio-pci.c=C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
=C2=A0hw/virtio/virtio.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 4 ++-- =C2=A0include/migration/vmstate.h |=C2=A0 2 +-
=C2=A0migration/cpr.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 4 ++--
=C2=A0migration/savevm.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 6 ++++--=
=C2=A0migration/vmstate-types.c=C2=A0 =C2=A0| 10 +++++-----
=C2=A0migration/vmstate.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 45 +++++++++++= +++++++++++++++++-----------------
=C2=A0tests/unit/test-vmstate.c=C2=A0 =C2=A0| 18 +++++++++---------
=C2=A0ui/vdagent.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |= =C2=A0 2 +-
=C2=A015 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 0a1a625b0ea6cf26cb0d799171a57ed3d3ab2442..5d2ca8d8b864350133a674802d7= 316abd379591c 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1343,7 +1343,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque,= size_t size,
=C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2=A0/* load & apply scanout state */
-=C2=A0 =C2=A0 vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1= );
+=C2=A0 =C2=A0 vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1= , NULL);

=C2=A0 =C2=A0 =C2=A0return 0;
=C2=A0}
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index c70b5ceebaf1f2b10768bd030526cbb518da2b8d..2ab5d30bb3c319ac1c7bfc9a2ac= f6a2b38082066 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -934,7 +934,7 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)
=C2=A0int pci_device_load(PCIDevice *s, QEMUFile *f)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0int ret;
-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_pci_device, s, s-= >version_id);
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_pci_device, s, s-= >version_id, NULL);
=C2=A0 =C2=A0 =C2=A0/* Restore the interrupt status bit. */
=C2=A0 =C2=A0 =C2=A0pci_update_irq_status(s);
=C2=A0 =C2=A0 =C2=A0return ret;
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index d2f85b39f30f7fc82e0c600144c0a958e1269b2c..2f6feff2b0a22d7d7f6aecfd7e7= 870d8362f1a73 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -1136,7 +1136,7 @@ static void virtio_ccw_save_config(DeviceState *d, QE= MUFile *f)
=C2=A0static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0VirtioCcwDevice *dev =3D VIRTIO_CCW_DEVICE(d);
-=C2=A0 =C2=A0 return vmstate_load_state(f, &vmstate_virtio_ccw_dev, de= v, 1);
+=C2=A0 =C2=A0 return vmstate_load_state(f, &vmstate_virtio_ccw_dev, de= v, 1, NULL);
=C2=A0}

=C2=A0static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp)
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index 20f70fb2729de78b9636a6b8c869695dab4f8902..573fdea668536b464bca11f001e= 9e0288e781493 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -648,7 +648,7 @@ static void *vscsi_load_request(QEMUFile *f, SCSIReques= t *sreq)
=C2=A0 =C2=A0 =C2=A0assert(!req->active);

=C2=A0 =C2=A0 =C2=A0memset(req, 0, sizeof(*req));
-=C2=A0 =C2=A0 rc =3D vmstate_load_state(f, &vmstate_spapr_vscsi_req, r= eq, 1);
+=C2=A0 =C2=A0 rc =3D vmstate_load_state(f, &vmstate_spapr_vscsi_req, r= eq, 1, NULL);
=C2=A0 =C2=A0 =C2=A0if (rc) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fprintf(stderr, "VSCSI: failed loadi= ng request tag#%u\n", sreq->tag);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index be05002b9819fafa45cf2fb4d2a0acdc475c558c..f8ce4a40dbe4c070a0d6c111051= 051ee97542719 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2797,7 +2797,7 @@ static int vfio_pci_load_config(VFIODevice *vbasedev,= QEMUFile *f)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0old_addr[bar] =3D pdev->io_regions[bar= ].addr;
=C2=A0 =C2=A0 =C2=A0}

-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_vfio_pci_config, = vdev, 1);
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_vfio_pci_config, = vdev, 1, NULL);
=C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0}
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 532c67107ba1d2978a76cf49f9cdc1de1dea3e11..9058b1563462d4464dcba799643= a583c93fb5683 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -619,7 +619,7 @@ static int virtio_mmio_load_extra_state(DeviceState *op= aque, QEMUFile *f)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0VirtIOMMIOProxy *proxy =3D VIRTIO_MMIO(opaque);

-=C2=A0 =C2=A0 return vmstate_load_state(f, &vmstate_virtio_mmio, proxy= , 1);
+=C2=A0 =C2=A0 return vmstate_load_state(f, &vmstate_virtio_mmio, proxy= , 1, NULL);
=C2=A0}

=C2=A0static bool virtio_mmio_has_extra_state(DeviceState *opaque)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 767216d795998708f5716a23ae16c79cd90ff489..f8b52a611e56c22d844fd4cae36= 19da4f2686d03 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -161,7 +161,7 @@ static int virtio_pci_load_extra_state(DeviceState *d, = QEMUFile *f)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0VirtIOPCIProxy *proxy =3D to_virtio_pci_proxy(d);

-=C2=A0 =C2=A0 return vmstate_load_state(f, &vmstate_virtio_pci, proxy,= 1);
+=C2=A0 =C2=A0 return vmstate_load_state(f, &vmstate_virtio_pci, proxy,= 1, NULL);
=C2=A0}

=C2=A0static void virtio_pci_save_queue(DeviceState *d, int n, QEMUFile *f)=
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2ab1d20769495ea39445b87e3673b076ad172510..d5698b062a1e95437f6113f4113= 6e90ae06f1974 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3317,14 +3317,14 @@ virtio_load(VirtIODevice *vdev, QEMUFile *f, int ve= rsion_id)
=C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2=A0if (vdc->vmsd) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vdc->vmsd, vd= ev, version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vdc->vmsd, vd= ev, version_id, NULL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}

=C2=A0 =C2=A0 =C2=A0/* Subsections */
-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_virtio, vdev, 1);=
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_virtio, vdev, 1, = NULL);
=C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0}
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 1ff7bd9ac425ba67cd5ca7ad97bcf570f9e19abe..056781b1c21e737583f081594d9= f88b32adfd674 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1196,7 +1196,7 @@ extern const VMStateInfo vmstate_info_qlist;
=C2=A0 =C2=A0 =C2=A0}

=C2=A0int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0void *opaque, int version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0void *opaque, int version_id, Error **errp);
=C2=A0int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 void *opaque, JSONWriter *vmdesc);
=C2=A0int vmstate_save_state_with_err(QEMUFile *f, const VMStateDescription= *vmsd,
diff --git a/migration/cpr.c b/migration/cpr.c
index 42ad0b0d500e5de57faf0c6517e216b2d1c0cacf..74fac9521717ec568d14dabcbcb= 574b19fc1da67 100644
--- a/migration/cpr.c
+++ b/migration/cpr.c
@@ -233,9 +233,9 @@ int cpr_state_load(MigrationChannel *channel, Error **e= rrp)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENOTSUP;
=C2=A0 =C2=A0 =C2=A0}

-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_cpr_state, &c= pr_state, 1);
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_cpr_state, &c= pr_state, 1, errp);
=C2=A0 =C2=A0 =C2=A0if (ret) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "vmstate_load_state erro= r %d", ret);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_prepend(errp, "vmstate_load_state e= rror %d ", ret);

Although it's= not enforced, I think it's recommended to end the error_prepend() stri= ng with ": ", not just a space.
=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_fclose(f);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0}
diff --git a/migration/savevm.c b/migration/savevm.c
index fabbeb296ae987d0c06ba6dafda63720205fecfd..ab947620f724874f325fb9fb59b= ef50b7c16fb51 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -969,7 +969,8 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se= )
=C2=A0 =C2=A0 =C2=A0if (!se->vmsd) {=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/*= Old style */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return se->ops->load_state(f, se-&g= t;opaque, se->load_version_id);
=C2=A0 =C2=A0 =C2=A0}
-=C2=A0 =C2=A0 return vmstate_load_state(f, se->vmsd, se->opaque, se-= >load_version_id);
+=C2=A0 =C2=A0 return vmstate_load_state(f, se->vmsd, se->opaque, se-= >load_version_id,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 NULL);
=C2=A0}

=C2=A0static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, @@ -2839,7 +2840,8 @@ static int qemu_loadvm_state_header(QEMUFile *f)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("Configur= ation section missing");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -EINVAL;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_con= figuration, &savevm_state, 0);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_con= figuration, &savevm_state, 0,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NULL);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
index 741a588b7e18c6d37724b08a0101edc8bc74a0a5..1c5b76e1dd198030847971bc356= 37867c9d54fc0 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -549,7 +549,7 @@ static int get_tmp(QEMUFile *f, void *pv, size_t size,<= br>
=C2=A0 =C2=A0 =C2=A0/* Writes the parent field which is at the start of the= tmp */
=C2=A0 =C2=A0 =C2=A0*(void **)tmp =3D pv;
-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vmsd, tmp, version_id);
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vmsd, tmp, version_id, NULL);<= br> =C2=A0 =C2=A0 =C2=A0g_free(tmp);
=C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0}
@@ -649,7 +649,7 @@ static int get_qtailq(QEMUFile *f, void *pv, size_t unu= sed_size,

=C2=A0 =C2=A0 =C2=A0while (qemu_get_byte(f)) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0elm =3D g_malloc(size);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vmsd, elm, versi= on_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vmsd, elm, versi= on_id, NULL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
@@ -803,7 +803,7 @@ static int get_gtree(QEMUFile *f, void *pv, size_t unus= ed_size,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0key =3D (void *)(uintptr_t)= qemu_get_be64(f);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0key =3D g_malloc0(key_size)= ;
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, ke= y_vmsd, key, version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, ke= y_vmsd, key, version_id, NULL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report(= "%s : failed to load %s (%d)",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 field->name, key_vmsd->name, ret); @@ -811,7 +811,7 @@ static int get_gtree(QEMUFile *f, void *pv, size_t unus= ed_size,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val =3D g_malloc0(val_size);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, val_vmsd, val, v= ersion_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, val_vmsd, val, v= ersion_id, NULL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("%s : fai= led to load %s (%d)",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 field->name, val_vmsd->name, ret);
@@ -892,7 +892,7 @@ static int get_qlist(QEMUFile *f, void *pv, size_t unus= ed_size,

=C2=A0 =C2=A0 =C2=A0while (qemu_get_byte(f)) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0elm =3D g_malloc(size);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vmsd, elm, versi= on_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, vmsd, elm, versi= on_id, NULL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0error_report("%s: fail= ed to load %s (%d)", field->name,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 vmsd->name, ret);
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 129b19d7603a0ddf8ab6e946e41c1c4d773d1fa8..288b57e1ed778cce21247b64d5e= 97dfef41ad586 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -132,29 +132,33 @@ static void vmstate_handle_alloc(void *ptr, const VMS= tateField *field,
=C2=A0}

=C2=A0int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0void *opaque, int version_id)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0void *opaque, int version_id, Error **errp)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0const VMStateField *field =3D vmsd->fields;
=C2=A0 =C2=A0 =C2=A0int ret =3D 0;

=C2=A0 =C2=A0 =C2=A0trace_vmstate_load_state(vmsd->name, version_id); =C2=A0 =C2=A0 =C2=A0if (version_id > vmsd->version_id) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_report("%s: incoming version_id %d = is too new "
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"for local version_id %d",
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0vmsd->name, version_id, vmsd->version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "%s: incoming version_id= %d is too new "
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= ;for local version_id %d",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vmsd-= >name, version_id, vmsd->version_id);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0trace_vmstate_load_state_end(vmsd->nam= e, "too new", -EINVAL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -EINVAL;
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0if=C2=A0 (version_id < vmsd->minimum_version_id) = {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_report("%s: incoming version_id %d = is too old "
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0"for local minimum version_id=C2=A0 %d",
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0vmsd->name, version_id, vmsd->minimum_version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "%s: incoming version_id= %d is too old "
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"= ;for local minimum version_id=C2=A0 %d",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vmsd-= >name, version_id, vmsd->minimum_version_id);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0trace_vmstate_load_state_end(vmsd->nam= e, "too old", -EINVAL);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -EINVAL;
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0if (vmsd->pre_load) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D vmsd->pre_load(opaque);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "VM pre lo= ad failed for: '%s', "
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"version_id: '%d', minimum version_id: '%d',= ret: %d",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0vmsd->name, vmsd->version_id, vmsd->minimum_version_id,<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0ret);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
@@ -192,10 +196,12 @@ int vmstate_load_state(QEMUFile *f, const VMStateDesc= ription *vmsd,

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (inner_fie= ld->flags & VMS_STRUCT) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0ret =3D vmstate_load_state(f, inner_field->vmsd, curr_elem,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0inner_field->vmsd->version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0inner_field->vmsd->version_id,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0errp);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (in= ner_field->flags & VMS_VSTRUCT) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0ret =3D vmstate_load_state(f, inner_field->vmsd, curr_elem,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0inner_field->struct_version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0inner_field->struct_version_id,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0errp);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0ret =3D inner_field->info->get(f, curr_elem, size,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 inner_field);
@@ -211,27 +217,32 @@ int vmstate_load_state(QEMUFile *f, const VMStateDesc= ription *vmsd,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret < = 0) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0qemu_file_set_error(f, ret);
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 erro= r_report("Failed to load %s:%s", vmsd->name,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0field->name);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 erro= r_prepend(errp, "Failed to load %s:%s version_id: %d ",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vmsd->name, field->name= , vmsd->version_id);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0trace_vmstate_load_field_error(field->name, ret);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0return ret;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else if (field->flags & VMS_MUST= _EXIST) {
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_report("Input validat= ion failed: %s/%s",
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0vmsd->name, field->name);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "Input val= idation failed: %s/%s version_id: %d",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0vmsd->name, field->name, vmsd->version_id);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0field++;
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0assert(field->flags =3D=3D VMS_END);
-=C2=A0 =C2=A0 ret =3D vmstate_subsection_load(f, vmsd, opaque, NULL);
+=C2=A0 =C2=A0 ret =3D vmstate_subsection_load(f, vmsd, opaque, errp);
=C2=A0 =C2=A0 =C2=A0if (ret !=3D 0) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_file_set_error(f, ret);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0if (vmsd->post_load) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D vmsd->post_load(opaque, versio= n_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ret < 0) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "VM Post l= oad failed for: %s, version_id: %d,"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"minimum_version: %d, ret: %d", vmsd->name,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0vmsd->version_id, vmsd->minimum_version_id, ret);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0trace_vmstate_load_state_end(vmsd->name, "end&q= uot;, ret);
=C2=A0 =C2=A0 =C2=A0return ret;
@@ -607,11 +618,11 @@ static int vmstate_subsection_load(QEMUFile *f, const= VMStateDescription *vmsd,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_file_skip(f, len); /* idstr */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0version_id =3D qemu_get_be32(f);

-=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, sub_vmsd, opaque= , version_id);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 ret =3D vmstate_load_state(f, sub_vmsd, opaque= , version_id, errp);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0trace_vmstate_subsection_lo= ad_bad(vmsd->name, idstr, "(child)");
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "Loading V= M subsection '%s' in '%s' failed : %d",
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0idstr, vmsd->name, ret);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_prepend(errp, "Loadin= g VM subsection '%s'"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "in '%s' failed : %d ", idstr, vmsd->= ;name, ret);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
index 63f28f26f45691a70936d33e7341d16477a3471f..ca5e0ba1e3e5e2bb0a1ce39143a= 292f2c6f9420a 100644
--- a/tests/unit/test-vmstate.c
+++ b/tests/unit/test-vmstate.c
@@ -114,7 +114,7 @@ static int load_vmstate_one(const VMStateDescription *d= esc, void *obj,
=C2=A0 =C2=A0 =C2=A0qemu_fclose(f);

=C2=A0 =C2=A0 =C2=A0f =3D open_test_file(false);
-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, desc, obj, version);
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, desc, obj, version, NULL);
=C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0g_assert(qemu_file_get_error(f));
=C2=A0 =C2=A0 =C2=A0} else{
@@ -365,7 +365,7 @@ static void test_load_v1(void)

=C2=A0 =C2=A0 =C2=A0QEMUFile *loading =3D open_test_file(false);
=C2=A0 =C2=A0 =C2=A0TestStruct obj =3D { .b =3D 200, .e =3D 500, .f =3D 600= };
-=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_versioned, &obj= , 1);
+=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_versioned, &obj= , 1, NULL);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(loading));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.a, =3D=3D, 10);
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.b, =3D=3D, 200);
@@ -391,7 +391,7 @@ static void test_load_v2(void)

=C2=A0 =C2=A0 =C2=A0QEMUFile *loading =3D open_test_file(false);
=C2=A0 =C2=A0 =C2=A0TestStruct obj;
-=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_versioned, &obj= , 2);
+=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_versioned, &obj= , 2, NULL);
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.a, =3D=3D, 10);
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.b, =3D=3D, 20);
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.c, =3D=3D, 30);
@@ -480,7 +480,7 @@ static void test_load_noskip(void)

=C2=A0 =C2=A0 =C2=A0QEMUFile *loading =3D open_test_file(false);
=C2=A0 =C2=A0 =C2=A0TestStruct obj =3D { .skip_c_e =3D false };
-=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_skipping, &obj,= 2);
+=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_skipping, &obj,= 2, NULL);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(loading));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.a, =3D=3D, 10);
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.b, =3D=3D, 20);
@@ -504,7 +504,7 @@ static void test_load_skip(void)

=C2=A0 =C2=A0 =C2=A0QEMUFile *loading =3D open_test_file(false);
=C2=A0 =C2=A0 =C2=A0TestStruct obj =3D { .skip_c_e =3D true, .c =3D 300, .e= =3D 500 };
-=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_skipping, &obj,= 2);
+=C2=A0 =C2=A0 vmstate_load_state(loading, &vmstate_skipping, &obj,= 2, NULL);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(loading));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.a, =3D=3D, 10);
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(obj.b, =3D=3D, 20);
@@ -773,7 +773,7 @@ static void test_load_q(void)
=C2=A0 =C2=A0 =C2=A0TestQtailq tgt;

=C2=A0 =C2=A0 =C2=A0QTAILQ_INIT(&tgt.q);
-=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_q, &tgt, 1);
+=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_q, &tgt, 1, NULL)= ;
=C2=A0 =C2=A0 =C2=A0char eof =3D qemu_get_byte(fload);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(fload));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(tgt.i16, =3D=3D, obj_q.i16);
@@ -1127,7 +1127,7 @@ static void test_gtree_load_domain(void)

=C2=A0 =C2=A0 =C2=A0fload =3D open_test_file(false);

-=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_domain, dest_domain, = 1);
+=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_domain, dest_domain, = 1, NULL);
=C2=A0 =C2=A0 =C2=A0eof =3D qemu_get_byte(fload);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(fload));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(orig_domain->id, =3D=3D, dest_domain= ->id);
@@ -1241,7 +1241,7 @@ static void test_gtree_load_iommu(void)
=C2=A0 =C2=A0 =C2=A0qemu_fclose(fsave);

=C2=A0 =C2=A0 =C2=A0fload =3D open_test_file(false);
-=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1)= ;
+=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_iommu, dest_iommu, 1,= NULL);
=C2=A0 =C2=A0 =C2=A0eof =3D qemu_get_byte(fload);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(fload));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(orig_iommu->id, =3D=3D, dest_iommu-&= gt;id);
@@ -1376,7 +1376,7 @@ static void test_load_qlist(void)
=C2=A0 =C2=A0 =C2=A0qemu_fclose(fsave);

=C2=A0 =C2=A0 =C2=A0fload =3D open_test_file(false);
-=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_container, dest_conta= iner, 1);
+=C2=A0 =C2=A0 vmstate_load_state(fload, &vmstate_container, dest_conta= iner, 1, NULL);
=C2=A0 =C2=A0 =C2=A0eof =3D qemu_get_byte(fload);
=C2=A0 =C2=A0 =C2=A0g_assert(!qemu_file_get_error(fload));
=C2=A0 =C2=A0 =C2=A0g_assert_cmpint(eof, =3D=3D, QEMU_VM_EOF);
diff --git a/ui/vdagent.c b/ui/vdagent.c
index c0746fe5b168fdc7aeb4866de2ba0c3387566649..83457dee0767433ad0778b37b41= b9c673a0e1860 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -1008,7 +1008,7 @@ static int get_cbinfo(QEMUFile *f, void *pv, size_t s= ize,

=C2=A0 =C2=A0 =C2=A0vdagent_clipboard_peer_register(vd);

-=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_cbinfo_array, &am= p;cbinfo, 0);
+=C2=A0 =C2=A0 ret =3D vmstate_load_state(f, &vmstate_cbinfo_array, &am= p;cbinfo, 0, NULL);
=C2=A0 =C2=A0 =C2=A0if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return ret;
=C2=A0 =C2=A0 =C2=A0}

--
2.50.0

--00000000000042e775063a6fa5a3--