All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Arun Menon <armenon@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"David Hildenbrand" <david@redhat.com>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Fam Zheng" <fam@euphon.net>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Hailiang Zhang" <zhanghailiang@xfusion.com>,
	"Steve Sistare" <steven.sistare@oracle.com>,
	qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
	"Stefan Berger" <stefanb@linux.vnet.ibm.com>
Subject: Re: [PATCH v3 2/3] migration: Introduce a post_load_with_error hook
Date: Wed, 2 Jul 2025 12:53:27 +0100	[thread overview]
Message-ID: <aGUdt7iCRQHGC1jR@redhat.com> (raw)
In-Reply-To: <20250702-propagate_tpm_error-v3-2-986d94540528@redhat.com>

On Wed, Jul 02, 2025 at 05:06:51PM +0530, Arun Menon wrote:
> - Introduces a temporary `post_load_with_error()` hook.
>   This enables a gradual transition of error reporting,
>   eventually replacing `post_load` throughout the codebase.
> - Deliberately called in mutual exclusion from post_load() hook
>   to prevent conflicts during the transition.
> - Briefly discussed here : https://issues.redhat.com/browse/RHEL-82826

While the ticket is public, many of the comments are private
to RH. Generally any relevant info should be direclty included
in the commit message, so we don't rely on downstream vendor
bug trackers which may or may no be public long term.

> 
> Signed-off-by: Arun Menon <armenon@redhat.com>
> ---
>  include/migration/vmstate.h | 1 +
>  migration/vmstate.c         | 4 +++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index 056781b1c21e737583f081594d9f88b32adfd674..1c6e89c3b08a3914cde6dce3be5955978b6b7d0b 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -207,6 +207,7 @@ struct VMStateDescription {
>      MigrationPriority priority;
>      int (*pre_load)(void *opaque);

This is called from the same context as post_load, so deserves
the same change to add an "errp".

>      int (*post_load)(void *opaque, int version_id);
> +    int (*post_load_with_error)(void *opaque, int version_id, Error **errp);

This is a bit overly verbose, 'post_load_errp' is sufficient.

>      int (*pre_save)(void *opaque);
>      int (*post_save)(void *opaque);

I'm inclined to suggest we add 'errp' variants of these too.

IOW, do the general design fix, not the bare minimum for this
specific tpm problem.

Then, we should also add an explanatory comment

 /*
  * New impls should preferentally use 'errp' variants of
  * these methods, and existing impls incrementally converted.
  * The variants without 'errp' are intended to be removed
  * once all usage is converted.
  */

>      bool (*needed)(void *opaque);
> diff --git a/migration/vmstate.c b/migration/vmstate.c
> index 158dcc3fcddfe70ab268dc5ace6e4573fa1ccbab..0048c4e1e7ee1d6ff3a3349abb0dc1578985a56e 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -236,7 +236,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>          }
>          return ret;
>      }
> -    if (vmsd->post_load) {
> +    if (vmsd->post_load_with_error) {
> +        ret = vmsd->post_load_with_error(opaque, version_id, errp);
> +    } else if (vmsd->post_load) {
>          ret = vmsd->post_load(opaque, version_id);
>      }
>      trace_vmstate_load_state_end(vmsd->name, "end", ret);
> 
> -- 
> 2.49.0
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-07-02 11:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 11:36 [PATCH v3 0/3] migration: propagate vTPM errors using Error objects Arun Menon
2025-07-02 11:36 ` [PATCH v3 1/3] migration: Pass Error object errp into vm state loading functions Arun Menon
2025-07-02 12:08   ` Daniel P. Berrangé
2025-07-02 14:42     ` Arun Menon
2025-07-02 13:01   ` Markus Armbruster
2025-07-02 14:53     ` Arun Menon
2025-07-02 11:36 ` [PATCH v3 2/3] migration: Introduce a post_load_with_error hook Arun Menon
2025-07-02 11:53   ` Daniel P. Berrangé [this message]
2025-07-02 11:36 ` [PATCH v3 3/3] backends/tpm: Propagate vTPM error on migration failure Arun Menon
2025-07-02 11:55   ` Daniel P. Berrangé

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=aGUdt7iCRQHGC1jR@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=armenon@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=david@redhat.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=mst@redhat.com \
    --cc=npiggin@gmail.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --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=stefanb@linux.vnet.ibm.com \
    --cc=steven.sistare@oracle.com \
    --cc=thuth@redhat.com \
    --cc=zhanghailiang@xfusion.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.