qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Remove res_compatible parameter
@ 2023-02-15 17:03 Juan Quintela
  2023-02-15 17:03 ` [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only Juan Quintela
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Juan Quintela @ 2023-02-15 17:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Halil Pasic, Juan Quintela, Christian Borntraeger,
	Fam Zheng, Vladimir Sementsov-Ogievskiy, Alex Williamson,
	qemu-s390x, Thomas Huth, Eric Farman, Stefan Hajnoczi, Eric Blake,
	Richard Henderson, qemu-block, Dr. David Alan Gilbert,
	Ilya Leoshkevich, David Hildenbrand

Hi

In this v2:
- rename res_postocopy_only ->can_postcopy
- rename res_precopy_only -> must_precopy
- Rewrite comments after discussions with Vladimir.
- 2nd patch is reviewd-by Vladimir.

Please, review.

[v1]
This series are the redo of the series from vfio.  Vladimir
Sementsov-Ogievskiy <vsementsov@yandex-team.ru> asked that I split the
change in ram.c (only place that set res_compatible), and the rest of
the patches.
So I ended:
- change ram.c to put the memory in res_postcopy
- remove res_compatible
- rename res_postcopy/precopy_only to not have the _only suffix.

Please review.

Juan Quintela (3):
  migration: In case of postcopy, the memory ends in res_postcopy_only
  migration: Remove unused res_compatible
  migration: Rename res_{postcopy,precopy}_only

 include/migration/register.h   | 30 +++++++++++++++---------------
 migration/savevm.h             | 10 ++++------
 hw/s390x/s390-stattrib.c       |  8 +++-----
 hw/vfio/migration.c            | 11 ++++-------
 migration/block-dirty-bitmap.c |  7 +++----
 migration/block.c              |  8 +++-----
 migration/migration.c          | 20 +++++++++-----------
 migration/ram.c                | 20 ++++++++------------
 migration/savevm.c             | 28 ++++++++++------------------
 hw/vfio/trace-events           |  2 +-
 migration/trace-events         |  4 ++--
 11 files changed, 62 insertions(+), 86 deletions(-)

-- 
2.39.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
  2023-02-15 17:03 [PATCH v2 0/3] Remove res_compatible parameter Juan Quintela
@ 2023-02-15 17:03 ` Juan Quintela
  2023-02-15 17:34   ` Vladimir Sementsov-Ogievskiy
  2023-02-15 17:03 ` [PATCH v2 2/3] migration: Remove unused res_compatible Juan Quintela
  2023-02-15 17:03 ` [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only Juan Quintela
  2 siblings, 1 reply; 7+ messages in thread
From: Juan Quintela @ 2023-02-15 17:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Halil Pasic, Juan Quintela, Christian Borntraeger,
	Fam Zheng, Vladimir Sementsov-Ogievskiy, Alex Williamson,
	qemu-s390x, Thomas Huth, Eric Farman, Stefan Hajnoczi, Eric Blake,
	Richard Henderson, qemu-block, Dr. David Alan Gilbert,
	Ilya Leoshkevich, David Hildenbrand

So remove last assignation of res_compatible.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/ram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/ram.c b/migration/ram.c
index 521912385d..ecf697a58d 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3528,7 +3528,7 @@ static void ram_state_pending_exact(void *opaque,
 
     if (migrate_postcopy_ram()) {
         /* We can do postcopy, and all the data is postcopiable */
-        *res_compatible += remaining_size;
+        *res_postcopy_only += remaining_size;
     } else {
         *res_precopy_only += remaining_size;
     }
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] migration: Remove unused res_compatible
  2023-02-15 17:03 [PATCH v2 0/3] Remove res_compatible parameter Juan Quintela
  2023-02-15 17:03 ` [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only Juan Quintela
@ 2023-02-15 17:03 ` Juan Quintela
  2023-02-15 17:03 ` [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only Juan Quintela
  2 siblings, 0 replies; 7+ messages in thread
From: Juan Quintela @ 2023-02-15 17:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Halil Pasic, Juan Quintela, Christian Borntraeger,
	Fam Zheng, Vladimir Sementsov-Ogievskiy, Alex Williamson,
	qemu-s390x, Thomas Huth, Eric Farman, Stefan Hajnoczi, Eric Blake,
	Richard Henderson, qemu-block, Dr. David Alan Gilbert,
	Ilya Leoshkevich, David Hildenbrand

Nothing assigns to it after previous commit.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/register.h   |  7 ++-----
 migration/savevm.h             |  2 --
 hw/s390x/s390-stattrib.c       |  1 -
 hw/vfio/migration.c            |  3 +--
 migration/block-dirty-bitmap.c |  1 -
 migration/block.c              |  1 -
 migration/migration.c          | 18 ++++++++----------
 migration/ram.c                |  2 --
 migration/savevm.c             |  8 ++------
 hw/vfio/trace-events           |  2 +-
 migration/trace-events         |  4 ++--
 11 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/include/migration/register.h b/include/migration/register.h
index b91a0cdbf8..a958a92a0f 100644
--- a/include/migration/register.h
+++ b/include/migration/register.h
@@ -49,22 +49,19 @@ typedef struct SaveVMHandlers {
     /* Note for save_live_pending:
      * - res_precopy_only is for data which must be migrated in precopy phase
      *     or in stopped state, in other words - before target vm start
-     * - res_compatible is for data which may be migrated in any phase
      * - res_postcopy_only is for data which must be migrated in postcopy phase
      *     or in stopped state, in other words - after source vm stop
      *
-     * Sum of res_postcopy_only, res_compatible and res_postcopy_only is the
-     * whole amount of pending data.
+     * Sum of res_postcopy_only and res_postcopy_only is the whole
+     * amount of pending data.
      */
     /* This estimates the remaining data to transfer */
     void (*state_pending_estimate)(void *opaque,
                                    uint64_t *res_precopy_only,
-                                   uint64_t *res_compatible,
                                    uint64_t *res_postcopy_only);
     /* This calculate the exact remaining data to transfer */
     void (*state_pending_exact)(void *opaque,
                                 uint64_t *res_precopy_only,
-                                uint64_t *res_compatible,
                                 uint64_t *res_postcopy_only);
     LoadStateHandler *load_state;
     int (*load_setup)(QEMUFile *f, void *opaque);
diff --git a/migration/savevm.h b/migration/savevm.h
index b1901e68d5..bd625a644b 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -41,10 +41,8 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f);
 int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
                                        bool inactivate_disks);
 void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
-                                     uint64_t *res_compatible,
                                      uint64_t *res_postcopy_only);
 void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
-                                        uint64_t *res_compatible,
                                         uint64_t *res_postcopy_only);
 void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
 void qemu_savevm_send_open_return_path(QEMUFile *f);
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index 3e32002eab..c7ae9184ab 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -184,7 +184,6 @@ static int cmma_save_setup(QEMUFile *f, void *opaque)
 
 static void cmma_state_pending(void *opaque,
                                uint64_t *res_precopy_only,
-                               uint64_t *res_compatible,
                                uint64_t *res_postcopy_only)
 {
     S390StAttribState *sas = S390_STATTRIB(opaque);
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index b3318f0f20..fb0dd9571d 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -458,7 +458,6 @@ static void vfio_save_cleanup(void *opaque)
 
 static void vfio_state_pending(void *opaque,
                                uint64_t *res_precopy_only,
-                               uint64_t *res_compatible,
                                uint64_t *res_postcopy_only)
 {
     VFIODevice *vbasedev = opaque;
@@ -473,7 +472,7 @@ static void vfio_state_pending(void *opaque,
     *res_precopy_only += migration->pending_bytes;
 
     trace_vfio_state_pending(vbasedev->name, *res_precopy_only,
-                            *res_postcopy_only, *res_compatible);
+                            *res_postcopy_only);
 }
 
 static int vfio_save_iterate(QEMUFile *f, void *opaque)
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 5a621419d3..9c6655e11a 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -764,7 +764,6 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque)
 
 static void dirty_bitmap_state_pending(void *opaque,
                                        uint64_t *res_precopy_only,
-                                       uint64_t *res_compatible,
                                        uint64_t *res_postcopy_only)
 {
     DBMSaveState *s = &((DBMState *)opaque)->save;
diff --git a/migration/block.c b/migration/block.c
index 29f69025af..99d149904c 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -865,7 +865,6 @@ static int block_save_complete(QEMUFile *f, void *opaque)
 
 static void block_state_pending(void *opaque,
                                 uint64_t *res_precopy_only,
-                                uint64_t *res_compatible,
                                 uint64_t *res_postcopy_only)
 {
     /* Estimate pending number of bytes to send */
diff --git a/migration/migration.c b/migration/migration.c
index 90fca70cb7..296f7fe768 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3863,20 +3863,18 @@ typedef enum {
  */
 static MigIterateState migration_iteration_run(MigrationState *s)
 {
-    uint64_t pend_pre, pend_compat, pend_post;
+    uint64_t pend_pre, pend_post;
     bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
 
-    qemu_savevm_state_pending_estimate(&pend_pre, &pend_compat, &pend_post);
-    uint64_t pending_size = pend_pre + pend_compat + pend_post;
+    qemu_savevm_state_pending_estimate(&pend_pre, &pend_post);
+    uint64_t pending_size = pend_pre + pend_post;
 
-    trace_migrate_pending_estimate(pending_size,
-                                   pend_pre, pend_compat, pend_post);
+    trace_migrate_pending_estimate(pending_size, pend_pre, pend_post);
 
-    if (pend_pre + pend_compat <= s->threshold_size) {
-        qemu_savevm_state_pending_exact(&pend_pre, &pend_compat, &pend_post);
-        pending_size = pend_pre + pend_compat + pend_post;
-        trace_migrate_pending_exact(pending_size,
-                                    pend_pre, pend_compat, pend_post);
+    if (pend_pre <= s->threshold_size) {
+        qemu_savevm_state_pending_exact(&pend_pre, &pend_post);
+        pending_size = pend_pre + pend_post;
+        trace_migrate_pending_exact(pending_size, pend_pre, pend_post);
     }
 
     if (!pending_size || pending_size < s->threshold_size) {
diff --git a/migration/ram.c b/migration/ram.c
index ecf697a58d..178f92a77f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3491,7 +3491,6 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
 
 static void ram_state_pending_estimate(void *opaque,
                                        uint64_t *res_precopy_only,
-                                       uint64_t *res_compatible,
                                        uint64_t *res_postcopy_only)
 {
     RAMState **temp = opaque;
@@ -3509,7 +3508,6 @@ static void ram_state_pending_estimate(void *opaque,
 
 static void ram_state_pending_exact(void *opaque,
                                     uint64_t *res_precopy_only,
-                                    uint64_t *res_compatible,
                                     uint64_t *res_postcopy_only)
 {
     RAMState **temp = opaque;
diff --git a/migration/savevm.c b/migration/savevm.c
index b5e6962bb6..80b7f1222a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1542,13 +1542,11 @@ flush:
  * for units that can't do postcopy.
  */
 void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
-                                        uint64_t *res_compatible,
                                         uint64_t *res_postcopy_only)
 {
     SaveStateEntry *se;
 
     *res_precopy_only = 0;
-    *res_compatible = 0;
     *res_postcopy_only = 0;
 
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
@@ -1561,19 +1559,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
             }
         }
         se->ops->state_pending_estimate(se->opaque,
-                                        res_precopy_only, res_compatible,
+                                        res_precopy_only,
                                         res_postcopy_only);
     }
 }
 
 void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
-                                     uint64_t *res_compatible,
                                      uint64_t *res_postcopy_only)
 {
     SaveStateEntry *se;
 
     *res_precopy_only = 0;
-    *res_compatible = 0;
     *res_postcopy_only = 0;
 
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
@@ -1586,7 +1582,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
             }
         }
         se->ops->state_pending_exact(se->opaque,
-                                     res_precopy_only, res_compatible,
+                                     res_precopy_only,
                                      res_postcopy_only);
     }
 }
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index 52de1c84f8..90a8aecb37 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -157,7 +157,7 @@ vfio_save_cleanup(const char *name) " (%s)"
 vfio_save_buffer(const char *name, uint64_t data_offset, uint64_t data_size, uint64_t pending) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64" pending 0x%"PRIx64
 vfio_update_pending(const char *name, uint64_t pending) " (%s) pending 0x%"PRIx64
 vfio_save_device_config_state(const char *name) " (%s)"
-vfio_state_pending(const char *name, uint64_t precopy, uint64_t postcopy, uint64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" compatible 0x%"PRIx64
+vfio_state_pending(const char *name, uint64_t precopy, uint64_t postcopy) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64
 vfio_save_iterate(const char *name, int data_size) " (%s) data_size %d"
 vfio_save_complete_precopy(const char *name) " (%s)"
 vfio_load_device_config_state(const char *name) " (%s)"
diff --git a/migration/trace-events b/migration/trace-events
index 67b65a70ff..422823b1db 100644
--- a/migration/trace-events
+++ b/migration/trace-events
@@ -150,8 +150,8 @@ migrate_fd_cleanup(void) ""
 migrate_fd_error(const char *error_desc) "error=%s"
 migrate_fd_cancel(void) ""
 migrate_handle_rp_req_pages(const char *rbname, size_t start, size_t len) "in %s at 0x%zx len 0x%zx"
-migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t compat, uint64_t post) "exact pending size %" PRIu64 " (pre = %" PRIu64 " compat=%" PRIu64 " post=%" PRIu64 ")"
-migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t compat, uint64_t post) "estimate pending size %" PRIu64 " (pre = %" PRIu64 " compat=%" PRIu64 " post=%" PRIu64 ")"
+migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t post) "exact pending size %" PRIu64 " (pre = %" PRIu64 " post=%" PRIu64 ")"
+migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t post) "estimate pending size %" PRIu64 " (pre = %" PRIu64 " post=%" PRIu64 ")"
 migrate_send_rp_message(int msg_type, uint16_t len) "%d: len %d"
 migrate_send_rp_recv_bitmap(char *name, int64_t size) "block '%s' size 0x%"PRIi64
 migration_completion_file_err(void) ""
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only
  2023-02-15 17:03 [PATCH v2 0/3] Remove res_compatible parameter Juan Quintela
  2023-02-15 17:03 ` [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only Juan Quintela
  2023-02-15 17:03 ` [PATCH v2 2/3] migration: Remove unused res_compatible Juan Quintela
@ 2023-02-15 17:03 ` Juan Quintela
  2023-02-15 17:53   ` Vladimir Sementsov-Ogievskiy
  2 siblings, 1 reply; 7+ messages in thread
From: Juan Quintela @ 2023-02-15 17:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Halil Pasic, Juan Quintela, Christian Borntraeger,
	Fam Zheng, Vladimir Sementsov-Ogievskiy, Alex Williamson,
	qemu-s390x, Thomas Huth, Eric Farman, Stefan Hajnoczi, Eric Blake,
	Richard Henderson, qemu-block, Dr. David Alan Gilbert,
	Ilya Leoshkevich, David Hildenbrand

Once that res_compatible is removed, they don't make sense anymore.
We remove the _only preffix.  And to make things clearer we rename
them to must_precopy and can_postcopy.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/register.h   | 27 +++++++++++++++------------
 migration/savevm.h             |  8 ++++----
 hw/s390x/s390-stattrib.c       |  7 +++----
 hw/vfio/migration.c            | 10 ++++------
 migration/block-dirty-bitmap.c |  6 +++---
 migration/block.c              |  7 +++----
 migration/migration.c          | 18 +++++++++---------
 migration/ram.c                | 18 ++++++++----------
 migration/savevm.c             | 24 ++++++++++--------------
 9 files changed, 59 insertions(+), 66 deletions(-)

diff --git a/include/migration/register.h b/include/migration/register.h
index a958a92a0f..a8dfd8fefd 100644
--- a/include/migration/register.h
+++ b/include/migration/register.h
@@ -47,22 +47,25 @@ typedef struct SaveVMHandlers {
     /* This runs outside the iothread lock!  */
     int (*save_setup)(QEMUFile *f, void *opaque);
     /* Note for save_live_pending:
-     * - res_precopy_only is for data which must be migrated in precopy phase
-     *     or in stopped state, in other words - before target vm start
-     * - res_postcopy_only is for data which must be migrated in postcopy phase
-     *     or in stopped state, in other words - after source vm stop
+     * must_precopy:
+     * - must be migrated in precopy or in stopped state
+     * - i.e. must be migrated before target start
      *
-     * Sum of res_postcopy_only and res_postcopy_only is the whole
-     * amount of pending data.
+     * can_postcopy:
+     * - can migrate in postcopy or in stopped state
+     * - i.e. can migrate after target start
+     * - some can also be migrated during precopy (RAM)
+     * - some must be migrated after source stops (block-dirty-bitmap)
+     *
+     * Sum of can_postcopy and must_postcopy is the whole amount of
+     * pending data.
      */
     /* This estimates the remaining data to transfer */
-    void (*state_pending_estimate)(void *opaque,
-                                   uint64_t *res_precopy_only,
-                                   uint64_t *res_postcopy_only);
+    void (*state_pending_estimate)(void *opaque, uint64_t *must_precopy,
+                                   uint64_t *can_postcopy);
     /* This calculate the exact remaining data to transfer */
-    void (*state_pending_exact)(void *opaque,
-                                uint64_t *res_precopy_only,
-                                uint64_t *res_postcopy_only);
+    void (*state_pending_exact)(void *opaque, uint64_t *must_precopy,
+                                uint64_t *can_postcopy);
     LoadStateHandler *load_state;
     int (*load_setup)(QEMUFile *f, void *opaque);
     int (*load_cleanup)(void *opaque);
diff --git a/migration/savevm.h b/migration/savevm.h
index bd625a644b..fb636735f0 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -40,10 +40,10 @@ void qemu_savevm_state_cleanup(void);
 void qemu_savevm_state_complete_postcopy(QEMUFile *f);
 int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only,
                                        bool inactivate_disks);
-void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
-                                     uint64_t *res_postcopy_only);
-void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
-                                        uint64_t *res_postcopy_only);
+void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
+                                     uint64_t *can_postcopy);
+void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
+                                        uint64_t *can_postcopy);
 void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
 void qemu_savevm_send_open_return_path(QEMUFile *f);
 int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index c7ae9184ab..aed919ad7d 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -182,16 +182,15 @@ static int cmma_save_setup(QEMUFile *f, void *opaque)
     return 0;
 }
 
-static void cmma_state_pending(void *opaque,
-                               uint64_t *res_precopy_only,
-                               uint64_t *res_postcopy_only)
+static void cmma_state_pending(void *opaque, uint64_t *must_precopy,
+                               uint64_t *can_postcopy)
 {
     S390StAttribState *sas = S390_STATTRIB(opaque);
     S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
     long long res = sac->get_dirtycount(sas);
 
     if (res >= 0) {
-        *res_precopy_only += res;
+        *must_precopy += res;
     }
 }
 
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index fb0dd9571d..83d2d44080 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -456,9 +456,8 @@ static void vfio_save_cleanup(void *opaque)
     trace_vfio_save_cleanup(vbasedev->name);
 }
 
-static void vfio_state_pending(void *opaque,
-                               uint64_t *res_precopy_only,
-                               uint64_t *res_postcopy_only)
+static void vfio_state_pending(void *opaque, uint64_t *must_precopy,
+                               uint64_t *can_postcopy)
 {
     VFIODevice *vbasedev = opaque;
     VFIOMigration *migration = vbasedev->migration;
@@ -469,10 +468,9 @@ static void vfio_state_pending(void *opaque,
         return;
     }
 
-    *res_precopy_only += migration->pending_bytes;
+    *must_precopy += migration->pending_bytes;
 
-    trace_vfio_state_pending(vbasedev->name, *res_precopy_only,
-                            *res_postcopy_only);
+    trace_vfio_state_pending(vbasedev->name, *must_precopy, *can_postcopy);
 }
 
 static int vfio_save_iterate(QEMUFile *f, void *opaque)
diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 9c6655e11a..fe73aa94b1 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -763,8 +763,8 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void *opaque)
 }
 
 static void dirty_bitmap_state_pending(void *opaque,
-                                       uint64_t *res_precopy_only,
-                                       uint64_t *res_postcopy_only)
+                                       uint64_t *must_precopy,
+                                       uint64_t *can_postcopy)
 {
     DBMSaveState *s = &((DBMState *)opaque)->save;
     SaveBitmapState *dbms;
@@ -784,7 +784,7 @@ static void dirty_bitmap_state_pending(void *opaque,
 
     trace_dirty_bitmap_state_pending(pending);
 
-    *res_postcopy_only += pending;
+    *can_postcopy += pending;
 }
 
 /* First occurrence of this bitmap. It should be created if doesn't exist */
diff --git a/migration/block.c b/migration/block.c
index 99d149904c..64cecbe5df 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -863,9 +863,8 @@ static int block_save_complete(QEMUFile *f, void *opaque)
     return 0;
 }
 
-static void block_state_pending(void *opaque,
-                                uint64_t *res_precopy_only,
-                                uint64_t *res_postcopy_only)
+static void block_state_pending(void *opaque, uint64_t *must_precopy,
+                                uint64_t *can_postcopy)
 {
     /* Estimate pending number of bytes to send */
     uint64_t pending;
@@ -886,7 +885,7 @@ static void block_state_pending(void *opaque,
 
     trace_migration_block_state_pending(pending);
     /* We don't do postcopy */
-    *res_precopy_only += pending;
+    *must_precopy += pending;
 }
 
 static int block_load(QEMUFile *f, void *opaque, int version_id)
diff --git a/migration/migration.c b/migration/migration.c
index 296f7fe768..ae2025d9d8 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3863,18 +3863,18 @@ typedef enum {
  */
 static MigIterateState migration_iteration_run(MigrationState *s)
 {
-    uint64_t pend_pre, pend_post;
+    uint64_t must_precopy, can_postcopy;
     bool in_postcopy = s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE;
 
-    qemu_savevm_state_pending_estimate(&pend_pre, &pend_post);
-    uint64_t pending_size = pend_pre + pend_post;
+    qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy);
+    uint64_t pending_size = must_precopy + can_postcopy;
 
-    trace_migrate_pending_estimate(pending_size, pend_pre, pend_post);
+    trace_migrate_pending_estimate(pending_size, must_precopy, can_postcopy);
 
-    if (pend_pre <= s->threshold_size) {
-        qemu_savevm_state_pending_exact(&pend_pre, &pend_post);
-        pending_size = pend_pre + pend_post;
-        trace_migrate_pending_exact(pending_size, pend_pre, pend_post);
+    if (must_precopy <= s->threshold_size) {
+        qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy);
+        pending_size = must_precopy + can_postcopy;
+        trace_migrate_pending_exact(pending_size, must_precopy, can_postcopy);
     }
 
     if (!pending_size || pending_size < s->threshold_size) {
@@ -3884,7 +3884,7 @@ static MigIterateState migration_iteration_run(MigrationState *s)
     }
 
     /* Still a significant amount to transfer */
-    if (!in_postcopy && pend_pre <= s->threshold_size &&
+    if (!in_postcopy && must_precopy <= s->threshold_size &&
         qatomic_read(&s->start_postcopy)) {
         if (postcopy_start(s)) {
             error_report("%s: postcopy failed to start", __func__);
diff --git a/migration/ram.c b/migration/ram.c
index 178f92a77f..96e8a19a58 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3489,9 +3489,8 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
     return 0;
 }
 
-static void ram_state_pending_estimate(void *opaque,
-                                       uint64_t *res_precopy_only,
-                                       uint64_t *res_postcopy_only)
+static void ram_state_pending_estimate(void *opaque, uint64_t *must_precopy,
+                                       uint64_t *can_postcopy)
 {
     RAMState **temp = opaque;
     RAMState *rs = *temp;
@@ -3500,15 +3499,14 @@ static void ram_state_pending_estimate(void *opaque,
 
     if (migrate_postcopy_ram()) {
         /* We can do postcopy, and all the data is postcopiable */
-        *res_postcopy_only += remaining_size;
+        *can_postcopy += remaining_size;
     } else {
-        *res_precopy_only += remaining_size;
+        *must_precopy += remaining_size;
     }
 }
 
-static void ram_state_pending_exact(void *opaque,
-                                    uint64_t *res_precopy_only,
-                                    uint64_t *res_postcopy_only)
+static void ram_state_pending_exact(void *opaque, uint64_t *must_precopy,
+                                    uint64_t *can_postcopy)
 {
     RAMState **temp = opaque;
     RAMState *rs = *temp;
@@ -3526,9 +3524,9 @@ static void ram_state_pending_exact(void *opaque,
 
     if (migrate_postcopy_ram()) {
         /* We can do postcopy, and all the data is postcopiable */
-        *res_postcopy_only += remaining_size;
+        *can_postcopy += remaining_size;
     } else {
-        *res_precopy_only += remaining_size;
+        *must_precopy += remaining_size;
     }
 }
 
diff --git a/migration/savevm.c b/migration/savevm.c
index 80b7f1222a..aa54a67fda 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1541,13 +1541,13 @@ flush:
  * the result is split into the amount for units that can and
  * for units that can't do postcopy.
  */
-void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
-                                        uint64_t *res_postcopy_only)
+void qemu_savevm_state_pending_estimate(uint64_t *must_precopy,
+                                        uint64_t *can_postcopy)
 {
     SaveStateEntry *se;
 
-    *res_precopy_only = 0;
-    *res_postcopy_only = 0;
+    *must_precopy = 0;
+    *can_postcopy = 0;
 
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
         if (!se->ops || !se->ops->state_pending_estimate) {
@@ -1558,19 +1558,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only,
                 continue;
             }
         }
-        se->ops->state_pending_estimate(se->opaque,
-                                        res_precopy_only,
-                                        res_postcopy_only);
+        se->ops->state_pending_estimate(se->opaque, must_precopy, can_postcopy);
     }
 }
 
-void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
-                                     uint64_t *res_postcopy_only)
+void qemu_savevm_state_pending_exact(uint64_t *must_precopy,
+                                     uint64_t *can_postcopy)
 {
     SaveStateEntry *se;
 
-    *res_precopy_only = 0;
-    *res_postcopy_only = 0;
+    *must_precopy = 0;
+    *can_postcopy = 0;
 
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
         if (!se->ops || !se->ops->state_pending_exact) {
@@ -1581,9 +1579,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only,
                 continue;
             }
         }
-        se->ops->state_pending_exact(se->opaque,
-                                     res_precopy_only,
-                                     res_postcopy_only);
+        se->ops->state_pending_exact(se->opaque, must_precopy, can_postcopy);
     }
 }
 
-- 
2.39.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only
  2023-02-15 17:03 ` [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only Juan Quintela
@ 2023-02-15 17:34   ` Vladimir Sementsov-Ogievskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2023-02-15 17:34 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel
  Cc: John Snow, Halil Pasic, Christian Borntraeger, Fam Zheng,
	Alex Williamson, qemu-s390x, Thomas Huth, Eric Farman,
	Stefan Hajnoczi, Eric Blake, Richard Henderson, qemu-block,
	Dr. David Alan Gilbert, Ilya Leoshkevich, David Hildenbrand

On 15.02.23 20:03, Juan Quintela wrote:
> So remove last assignation of res_compatible.
> 
> Signed-off-by: Juan Quintela<quintela@redhat.com>


Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

-- 
Best regards,
Vladimir



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only
  2023-02-15 17:03 ` [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only Juan Quintela
@ 2023-02-15 17:53   ` Vladimir Sementsov-Ogievskiy
  2023-02-15 18:15     ` Juan Quintela
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Sementsov-Ogievskiy @ 2023-02-15 17:53 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel
  Cc: John Snow, Halil Pasic, Christian Borntraeger, Fam Zheng,
	Alex Williamson, qemu-s390x, Thomas Huth, Eric Farman,
	Stefan Hajnoczi, Eric Blake, Richard Henderson, qemu-block,
	Dr. David Alan Gilbert, Ilya Leoshkevich, David Hildenbrand

On 15.02.23 20:03, Juan Quintela wrote:
> Once that res_compatible is removed, they don't make sense anymore.
> We remove the _only preffix.  And to make things clearer we rename
> them to must_precopy and can_postcopy.
> 
> Signed-off-by: Juan Quintela<quintela@redhat.com>

Ideally headers of trace events (trace_vfio_state_pending, trace_migrate_pending_estimate, trace_migrate_pending_exact)
should be changed correspondingly.

with or without:

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>


-- 
Best regards,
Vladimir



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only
  2023-02-15 17:53   ` Vladimir Sementsov-Ogievskiy
@ 2023-02-15 18:15     ` Juan Quintela
  0 siblings, 0 replies; 7+ messages in thread
From: Juan Quintela @ 2023-02-15 18:15 UTC (permalink / raw)
  To: Vladimir Sementsov-Ogievskiy
  Cc: qemu-devel, John Snow, Halil Pasic, Christian Borntraeger,
	Fam Zheng, Alex Williamson, qemu-s390x, Thomas Huth, Eric Farman,
	Stefan Hajnoczi, Eric Blake, Richard Henderson, qemu-block,
	Dr. David Alan Gilbert, Ilya Leoshkevich, David Hildenbrand

Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> wrote:
> On 15.02.23 20:03, Juan Quintela wrote:
>> Once that res_compatible is removed, they don't make sense anymore.
>> We remove the _only preffix.  And to make things clearer we rename
>> them to must_precopy and can_postcopy.
>> Signed-off-by: Juan Quintela<quintela@redhat.com>
>
> Ideally headers of trace events (trace_vfio_state_pending, trace_migrate_pending_estimate, trace_migrate_pending_exact)
> should be changed correspondingly.

They already use abrevs:

migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t post) "estimate pending size %" PRIu64 " (pre = %" PRIu64 " post=%" PRIu64 ")"

So I don't feel like doing bigger lines.

> with or without:
>
> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>

Thanks.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-15 18:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-15 17:03 [PATCH v2 0/3] Remove res_compatible parameter Juan Quintela
2023-02-15 17:03 ` [PATCH v2 1/3] migration: In case of postcopy, the memory ends in res_postcopy_only Juan Quintela
2023-02-15 17:34   ` Vladimir Sementsov-Ogievskiy
2023-02-15 17:03 ` [PATCH v2 2/3] migration: Remove unused res_compatible Juan Quintela
2023-02-15 17:03 ` [PATCH v2 3/3] migration: Rename res_{postcopy,precopy}_only Juan Quintela
2023-02-15 17:53   ` Vladimir Sementsov-Ogievskiy
2023-02-15 18:15     ` Juan Quintela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).