All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Avihai Horon <avihaih@nvidia.com>
Cc: qemu-devel@nongnu.org, "Alex Williamson" <alex@shazbot.org>,
	"Cédric Le Goater" <clg@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>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Jason Herne" <jjherne@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Ilya Leoshkevich" <iii@linux.ibm.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@yandex-team.ru>,
	"John Snow" <jsnow@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Maor Gottlieb" <maorg@nvidia.com>
Subject: Re: [PATCH v2 01/13] migration: Propagate errors in migration_completion_precopy()
Date: Wed, 3 Jun 2026 15:47:04 -0400	[thread overview]
Message-ID: <aiCEuAmX3qpWDS5n@x1.local> (raw)
In-Reply-To: <20260602092621.382-2-avihaih@nvidia.com>

On Tue, Jun 02, 2026 at 12:26:09PM +0300, 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 | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 074d3f2c69..7488a94206 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2814,7 +2814,7 @@ static bool migration_switchover_start(MigrationState *s, Error **errp)
>      return true;
>  }
>  
> -static int migration_completion_precopy(MigrationState *s)
> +static int migration_completion_precopy(MigrationState *s, Error **errp)
>  {
>      int ret;
>  
> @@ -2823,11 +2823,12 @@ static int migration_completion_precopy(MigrationState *s)
>      if (!migrate_mode_is_cpr()) {
>          ret = migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE);
>          if (ret < 0) {
> +            error_setg_errno(errp, -ret, "Failed to stop the VM");
>              goto out_unlock;
>          }
>      }
>  
> -    if (!migration_switchover_start(s, NULL)) {
> +    if (!migration_switchover_start(s, errp)) {
>          ret = -EFAULT;
>          goto out_unlock;
>      }

IIUC this patch overlooked the follow up call:

    ret = qemu_savevm_state_complete_precopy(s);

We should make sure ret!=0 will always set Error*.  Better pass Error**
into qemu_savevm_state_complete_precopy() too.

Thanks,

> @@ -2869,7 +2870,7 @@ static void migration_completion(MigrationState *s)
>      Error *local_err = NULL;
>  
>      if (s->state == MIGRATION_STATUS_ACTIVE) {
> -        ret = migration_completion_precopy(s);
> +        ret = migration_completion_precopy(s, &local_err);
>      } else if (s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
>          migration_completion_postcopy(s);
>      } else {
> @@ -2900,7 +2901,9 @@ static void migration_completion(MigrationState *s)
>      return;
>  
>  fail:
> -    if (qemu_file_get_error_obj(s->to_dst_file, &local_err)) {
> +    if (local_err) {
> +        migrate_error_propagate(s, local_err);
> +    } else if (qemu_file_get_error_obj(s->to_dst_file, &local_err)) {
>          migrate_error_propagate(s, local_err);
>      } else if (ret) {
>          error_setg_errno(&local_err, -ret, "Error in migration completion");
> -- 
> 2.40.1
> 

-- 
Peter Xu



  reply	other threads:[~2026-06-03 19:48 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  9:26 [PATCH v2 00/13] Make switchover-ack re-usable and add VFIO precopy REINIT feature Avihai Horon
2026-06-02  9:26 ` [PATCH v2 01/13] migration: Propagate errors in migration_completion_precopy() Avihai Horon
2026-06-03 19:47   ` Peter Xu [this message]
2026-06-04 15:12     ` Avihai Horon
2026-06-04 15:21       ` Peter Xu
2026-06-04 15:38         ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 02/13] migration: Run final save_query_pending at switchover Avihai Horon
2026-06-03 20:05   ` Peter Xu
2026-06-03 21:04     ` Peter Xu
2026-06-04 15:29       ` Avihai Horon
2026-06-04 17:18         ` Peter Xu
2026-06-08 12:07           ` Avihai Horon
2026-06-08 14:11             ` Peter Xu
2026-06-08 14:32               ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 03/13] migration: Log the approver in qemu_loadvm_approve_switchover() Avihai Horon
2026-06-02  9:26 ` [PATCH v2 04/13] migration: Replace switchover_ack_needed SaveVMHandler Avihai Horon
2026-06-02  9:26 ` [PATCH v2 05/13] migration: Rename switchover-ack code to legacy Avihai Horon
2026-06-03 20:21   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 06/13] migration: Make switchover-ack re-usable Avihai Horon
2026-06-03  7:17   ` Markus Armbruster
2026-06-04 15:05     ` Avihai Horon
2026-06-08 10:23       ` Markus Armbruster
2026-06-02  9:26 ` [PATCH v2 07/13] migration: Fail migration if switchover-ack is requested after switchover decision Avihai Horon
2026-06-03 20:42   ` Peter Xu
2026-06-04 15:36     ` Avihai Horon
2026-06-04 17:48       ` Peter Xu
2026-06-08 12:49         ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 08/13] vfio/migration: Extract VFIO_MIG_FLAG_DEV_INIT_DATA_SENT sending to helper Avihai Horon
2026-06-03 20:43   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 09/13] vfio/migration: Add Error ** parameter to vfio_migration_init() Avihai Horon
2026-06-03 11:38   ` Philippe Mathieu-Daudé
2026-06-04 15:06     ` Avihai Horon
2026-06-02  9:26 ` [PATCH v2 10/13] vfio/migration: Add new switchover-ack mechanism Avihai Horon
2026-06-03 20:47   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 11/13] vfio/migration: Implement VFIO_PRECOPY_INFO_REINIT feature Avihai Horon
2026-06-03 20:49   ` Peter Xu
2026-06-02  9:26 ` [PATCH v2 12/13] vfio/migration: Check VFIO_PRECOPY_INFO_REINIT during switchover Avihai Horon
2026-06-02  9:26 ` [PATCH v2 13/13] 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=aiCEuAmX3qpWDS5n@x1.local \
    --to=peterx@redhat.com \
    --cc=alex@shazbot.org \
    --cc=armbru@redhat.com \
    --cc=avihaih@nvidia.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=eblake@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=farosas@suse.de \
    --cc=iii@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=jsnow@redhat.com \
    --cc=maorg@nvidia.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=vsementsov@yandex-team.ru \
    --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.