All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: Avihai Horon <avihaih@nvidia.com>, qemu-devel@nongnu.org
Cc: "Alex Williamson" <alex@shazbot.org>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Maor Gottlieb" <maorg@nvidia.com>
Subject: Re: [PATCH 03/14] migration: Propagate errors in migration_completion_precopy()
Date: Thu, 7 May 2026 10:03:04 +0200	[thread overview]
Message-ID: <c439b516-b8f2-49de-907c-9dfa2edd9e2e@redhat.com> (raw)
In-Reply-To: <20260505081423.28326-4-avihaih@nvidia.com>

On 5/5/26 10:14, Avihai Horon wrote:
> migration_completion_precopy() doesn't propagate errors to migration
> core which leads to error information loss. Fix that.
> 
> This prepares for a follow-up where migration_switchover_start() can
> fail on switchover-ack and still report a useful error. Errors from
> qemu_savevm_state_complete_precopy() are not propagated yet as it
> requires more plumbing.
> 
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
> ---
>   migration/migration.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 6fd89995a2..a5c7ca6796 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2780,23 +2780,28 @@ static bool migration_switchover_start(MigrationState *s, Error **errp)
>   static int migration_completion_precopy(MigrationState *s)
>   {
>       int ret;
> +    Error *local_err = NULL;
>   
>       bql_lock();
>   
>       if (!migrate_mode_is_cpr()) {
>           ret = migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE);
>           if (ret < 0) {
> +            error_setg_errno(&local_err, -ret, "Failed to stop the VM");
>               goto out_unlock;
>           }
>       }
>   
> -    if (!migration_switchover_start(s, NULL)) {
> +    if (!migration_switchover_start(s, &local_err)) {
>           ret = -EFAULT;
>           goto out_unlock;
>       }
>   
>       ret = qemu_savevm_state_complete_precopy(s);
>   out_unlock:
> +    if (local_err) {
> +        migrate_error_propagate(s, local_err);
> +    }
>       bql_unlock();
>       return ret;
>   }

Instead, I would modify migration_completion_precopy() to use the Error
variable in migration_completion() :

   static void migration_completion(MigrationState *s)
   {
       int ret = 0;
       Error *local_err = NULL;

       if (s->state == MIGRATION_STATUS_ACTIVE) {
           ret = migration_completion_precopy(s);

       ...

Thanks,

C.




  reply	other threads:[~2026-05-07  8:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05  8:14 [PATCH 00/14] Make switchover-ack re-usable and add VFIO precopy REINIT feature Avihai Horon
2026-05-05  8:14 ` [PATCH 01/14] scripts/update-linux-headers: Add typelimits.h Avihai Horon
2026-05-07  7:54   ` Cédric Le Goater
2026-05-07  9:07     ` gaosong
2026-05-05  8:14 ` [PATCH 02/14] linux-headers: Update to Linux v7.1-rc1 Avihai Horon
2026-05-07  9:16   ` Cédric Le Goater
2026-05-05  8:14 ` [PATCH 03/14] migration: Propagate errors in migration_completion_precopy() Avihai Horon
2026-05-07  8:03   ` Cédric Le Goater [this message]
2026-05-08 13:01     ` Avihai Horon
2026-05-15 15:20       ` Peter Xu
2026-05-05  8:14 ` [PATCH 04/14] migration: Log the approver in qemu_loadvm_approve_switchover() Avihai Horon
2026-05-07  8:09   ` Cédric Le Goater
2026-05-08 13:07     ` Avihai Horon
2026-05-15 15:24   ` Peter Xu
2026-05-05  8:14 ` [PATCH 05/14] migration: Replace switchover_ack_needed SaveVMHandler Avihai Horon
2026-05-15 15:27   ` Peter Xu
2026-05-05  8:14 ` [PATCH 06/14] migration: Rename switchover-ack code to legacy Avihai Horon
2026-05-05  8:14 ` [PATCH 07/14] migration: Make switchover-ack re-usable Avihai Horon
2026-05-07 14:10   ` Fabiano Rosas
2026-05-05  8:14 ` [PATCH 08/14] migration: Check switchover-ack during switchover phase Avihai Horon
2026-05-05  8:14 ` [PATCH 09/14] vfio/migration: Re-query precopy size before sending VFIO_MIG_FLAG_DEV_INIT_DATA_SENT Avihai Horon
2026-05-07  8:24   ` Cédric Le Goater
2026-05-08 13:10     ` Avihai Horon
2026-05-05  8:14 ` [PATCH 10/14] vfio/migration: Add Error ** parameter to vfio_migration_init() Avihai Horon
2026-05-07  7:59   ` Cédric Le Goater
2026-05-08 13:18     ` Avihai Horon
2026-05-08 13:21       ` Avihai Horon
2026-05-05  8:14 ` [PATCH 11/14] vfio/migration: Add new switchover-ack mechanism Avihai Horon
2026-05-05  8:14 ` [PATCH 12/14] vfio/migration: Implement VFIO_PRECOPY_INFO_REINIT feature Avihai Horon
2026-05-05  8:14 ` [PATCH 13/14] vfio/migration: Check VFIO_PRECOPY_INFO_REINIT during switchover Avihai Horon
2026-05-05  8:14 ` [PATCH 14/14] migration: Enable new switchover-ack Avihai Horon

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=c439b516-b8f2-49de-907c-9dfa2edd9e2e@redhat.com \
    --to=clg@redhat.com \
    --cc=alex@shazbot.org \
    --cc=avihaih@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=farosas@suse.de \
    --cc=maorg@nvidia.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhao1.liu@intel.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.