[PATCH v7 08/24] migration: make loadvm_postcopy_handle_resume() void

Arun Menon posted 24 patches 3 months, 3 weeks ago
Maintainers: Stefan Berger <stefanb@linux.vnet.ibm.com>, "Michael S. Tsirkin" <mst@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, Dmitry Osipenko <dmitry.osipenko@collabora.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>, Matthew Rosato <mjrosato@linux.ibm.com>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>, Hailiang Zhang <zhanghailiang@xfusion.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Steve Sistare <steven.sistare@oracle.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
There is a newer version of this series
[PATCH v7 08/24] migration: make loadvm_postcopy_handle_resume() void
Posted by Arun Menon 3 months, 3 weeks ago
This is an incremental step in converting vmstate loading
code to report error via Error objects instead of directly
printing it to console/monitor.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Arun Menon <armenon@redhat.com>
---
 migration/savevm.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index d8f5f1966fda831899596173f20fbef25d78829d..ad96da3651b89023e4b70ffeecab46d176bae6f5 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2334,12 +2334,12 @@ static void migrate_send_rp_req_pages_pending(MigrationIncomingState *mis)
     }
 }
 
-static int loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
+static void loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
 {
     if (mis->state != MIGRATION_STATUS_POSTCOPY_RECOVER) {
-        error_report("%s: illegal resume received", __func__);
+        warn_report("%s: illegal resume received", __func__);
         /* Don't fail the load, only for this. */
-        return 0;
+        return;
     }
 
     /*
@@ -2391,8 +2391,6 @@ static int loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
         /* Kick the fast ram load thread too */
         qemu_sem_post(&mis->postcopy_pause_sem_fast_load);
     }
-
-    return 0;
 }
 
 /**
@@ -2627,7 +2625,8 @@ static int loadvm_process_command(QEMUFile *f)
         return loadvm_postcopy_ram_handle_discard(mis, len);
 
     case MIG_CMD_POSTCOPY_RESUME:
-        return loadvm_postcopy_handle_resume(mis);
+        loadvm_postcopy_handle_resume(mis);
+        return 0;
 
     case MIG_CMD_RECV_BITMAP:
         return loadvm_handle_recv_bitmap(mis, len);

-- 
2.50.0


Re: [PATCH v7 08/24] migration: make loadvm_postcopy_handle_resume() void
Posted by Marc-André Lureau 3 months, 2 weeks ago
Hi

On Fri, Jul 25, 2025 at 4:20 PM Arun Menon <armenon@redhat.com> wrote:

> This is an incremental step in converting vmstate loading
> code to report error via Error objects instead of directly
> printing it to console/monitor.
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Arun Menon <armenon@redhat.com>
> ---
>  migration/savevm.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/migration/savevm.c b/migration/savevm.c
> index
> d8f5f1966fda831899596173f20fbef25d78829d..ad96da3651b89023e4b70ffeecab46d176bae6f5
> 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2334,12 +2334,12 @@ static void
> migrate_send_rp_req_pages_pending(MigrationIncomingState *mis)
>      }
>  }
>
> -static int loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
> +static void loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
>  {
>      if (mis->state != MIGRATION_STATUS_POSTCOPY_RECOVER) {
> -        error_report("%s: illegal resume received", __func__);
> +        warn_report("%s: illegal resume received", __func__);
>

Could you add a comment to the commit message to explain why this somewhat
unrelated change? thanks


>          /* Don't fail the load, only for this. */
> -        return 0;
> +        return;
>      }
>
>      /*
> @@ -2391,8 +2391,6 @@ static int
> loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
>          /* Kick the fast ram load thread too */
>          qemu_sem_post(&mis->postcopy_pause_sem_fast_load);
>      }
> -
> -    return 0;
>  }
>
>  /**
> @@ -2627,7 +2625,8 @@ static int loadvm_process_command(QEMUFile *f)
>          return loadvm_postcopy_ram_handle_discard(mis, len);
>
>      case MIG_CMD_POSTCOPY_RESUME:
> -        return loadvm_postcopy_handle_resume(mis);
> +        loadvm_postcopy_handle_resume(mis);
> +        return 0;
>
>      case MIG_CMD_RECV_BITMAP:
>          return loadvm_handle_recv_bitmap(mis, len);
>
> --
> 2.50.0
>
>
Re: [PATCH v7 08/24] migration: make loadvm_postcopy_handle_resume() void
Posted by Arun Menon 3 months, 2 weeks ago
Hi Marc-André,
Thanks for the review.

On Mon, Jul 28, 2025 at 02:25:26PM +0400, Marc-André Lureau wrote:
> Hi
> 
> On Fri, Jul 25, 2025 at 4:20 PM Arun Menon <armenon@redhat.com> wrote:
> 
> > This is an incremental step in converting vmstate loading
> > code to report error via Error objects instead of directly
> > printing it to console/monitor.
> >
> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > Signed-off-by: Arun Menon <armenon@redhat.com>
> > ---
> >  migration/savevm.c | 11 +++++------
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/migration/savevm.c b/migration/savevm.c
> > index
> > d8f5f1966fda831899596173f20fbef25d78829d..ad96da3651b89023e4b70ffeecab46d176bae6f5
> > 100644
> > --- a/migration/savevm.c
> > +++ b/migration/savevm.c
> > @@ -2334,12 +2334,12 @@ static void
> > migrate_send_rp_req_pages_pending(MigrationIncomingState *mis)
> >      }
> >  }
> >
> > -static int loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
> > +static void loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
> >  {
> >      if (mis->state != MIGRATION_STATUS_POSTCOPY_RECOVER) {
> > -        error_report("%s: illegal resume received", __func__);
> > +        warn_report("%s: illegal resume received", __func__);
> >
> 
> Could you add a comment to the commit message to explain why this somewhat
> unrelated change? thanks
Sure, will do.
> 
> 
> >          /* Don't fail the load, only for this. */
> > -        return 0;
> > +        return;
> >      }
> >
> >      /*
> > @@ -2391,8 +2391,6 @@ static int
> > loadvm_postcopy_handle_resume(MigrationIncomingState *mis)
> >          /* Kick the fast ram load thread too */
> >          qemu_sem_post(&mis->postcopy_pause_sem_fast_load);
> >      }
> > -
> > -    return 0;
> >  }
> >
> >  /**
> > @@ -2627,7 +2625,8 @@ static int loadvm_process_command(QEMUFile *f)
> >          return loadvm_postcopy_ram_handle_discard(mis, len);
> >
> >      case MIG_CMD_POSTCOPY_RESUME:
> > -        return loadvm_postcopy_handle_resume(mis);
> > +        loadvm_postcopy_handle_resume(mis);
> > +        return 0;
> >
> >      case MIG_CMD_RECV_BITMAP:
> >          return loadvm_handle_recv_bitmap(mis, len);
> >
> > --
> > 2.50.0
> >
> >
Regards,
Arun