From: Cornelia Huck <cohuck@redhat.com>
To: Arun Menon <armenon@redhat.com>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Thomas Huth" <thuth@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"David Hildenbrand" <david@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Fam Zheng" <fam@euphon.net>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
"Arun Menon" <armenon@redhat.com>
Subject: Re: [PATCH] migration: Fix regression of passing error_fatal into vmstate_load_state()
Date: Mon, 27 Oct 2025 12:18:58 +0100 [thread overview]
Message-ID: <87v7k0twwt.fsf@redhat.com> (raw)
In-Reply-To: <20251024-solve_error_fatal_regression-v1-1-d26e6cbd0a7e@redhat.com>
On Fri, Oct 24 2025, Arun Menon <armenon@redhat.com> wrote:
> error_fatal is passed to vmstate_load_state() and vmstate_save_state()
> functions. This was introduced in commit c632ffbd74. This would exit(1)
> on error, and therefore does not allow to propagate the error back to
> the caller.
>
> To maintain consistency with prior error handling i.e. either propagating
> the error to the caller or reporting it, we must set the error within a
> local Error object instead of using error_fatal.
>
> Signed-off-by: Arun Menon <armenon@redhat.com>
> ---
> hw/display/virtio-gpu.c | 20 ++++++++++++++------
> hw/pci/pci.c | 13 +++++++++++--
> hw/s390x/virtio-ccw.c | 15 +++++++++++++--
> hw/scsi/spapr_vscsi.c | 9 +++++++--
> hw/virtio/virtio-mmio.c | 15 +++++++++++++--
> hw/virtio/virtio-pci.c | 15 +++++++++++++--
> hw/virtio/virtio.c | 10 +++++++---
> 7 files changed, 78 insertions(+), 19 deletions(-)
>
(...)
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 4cb1ced001ae241c53c503ebfd7c90e336799c37..41c7d62a482de3c618e71dd07c0cd23e1bcd5578 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -1130,13 +1130,24 @@ static int virtio_ccw_load_queue(DeviceState *d, int n, QEMUFile *f)
> static void virtio_ccw_save_config(DeviceState *d, QEMUFile *f)
> {
> VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
> - vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL, &error_fatal);
> + int ret;
> + Error *local_err = NULL;
> + ret = vmstate_save_state(f, &vmstate_virtio_ccw_dev, dev, NULL, &local_err);
> + if (ret < 0) {
> + error_report_err(local_err);
> + }
> }
>
> static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
> {
> VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(d);
> - return vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1, &error_fatal);
> + int ret;
> + Error *local_err = NULL;
> + ret = vmstate_load_state(f, &vmstate_virtio_ccw_dev, dev, 1, &local_err);
> + if (ret < 0) {
> + error_report_err(local_err);
> + }
> + return ret;
> }
>
> static void virtio_ccw_pre_plugged(DeviceState *d, Error **errp)
I was wondering whether it would make sense to pass the error object in
VirtioBusClass's ->{load,save}_config instead, but it seems virtio-ccw
is the only one using that pattern there (virtio-mmio and virtio-pci are
doing that dance in their ->{load,save}_extra_state callbacks); so let's
just do it this way and think about more error object passing later.
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
next prev parent reply other threads:[~2025-10-27 11:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 16:32 [PATCH] migration: Fix regression of passing error_fatal into vmstate_load_state() Arun Menon
2025-10-27 0:37 ` Akihiko Odaki
2025-10-28 6:24 ` Arun Menon
2025-10-27 11:18 ` Cornelia Huck [this message]
2025-10-28 6:24 ` Arun Menon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v7k0twwt.fsf@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armenon@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=fam@euphon.net \
--cc=farman@linux.ibm.com \
--cc=farosas@suse.de \
--cc=harshpb@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mjrosato@linux.ibm.com \
--cc=mst@redhat.com \
--cc=npiggin@gmail.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.