|
|
719b13 |
From be7a79cd5eb65f9835593f353220a3fe4fa7f30c Mon Sep 17 00:00:00 2001
|
|
|
719b13 |
From: David Edmondson <david.edmondson@oracle.com>
|
|
|
719b13 |
Date: Tue, 21 Dec 2021 09:34:40 +0000
|
|
|
719b13 |
Subject: [PATCH 27/34] migration: Introduce ram_transferred_add()
|
|
|
719b13 |
MIME-Version: 1.0
|
|
|
719b13 |
Content-Type: text/plain; charset=UTF-8
|
|
|
719b13 |
Content-Transfer-Encoding: 8bit
|
|
|
719b13 |
|
|
|
719b13 |
RH-Author: Leonardo Brás <leobras@redhat.com>
|
|
|
719b13 |
RH-MergeRequest: 185: MSG_ZEROCOPY + Multifd @ rhel8.6
|
|
|
719b13 |
RH-Commit: [27/34] fdc6eea0f4cf5ace0a71d981218ce150e98654ff
|
|
|
719b13 |
RH-Bugzilla: 2117252
|
|
|
719b13 |
RH-Acked-by: quintela1 <quintela@redhat.com>
|
|
|
719b13 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
719b13 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
719b13 |
|
|
|
719b13 |
Replace direct manipulation of ram_counters.transferred with a
|
|
|
719b13 |
function.
|
|
|
719b13 |
|
|
|
719b13 |
Signed-off-by: David Edmondson <david.edmondson@oracle.com>
|
|
|
719b13 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
719b13 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
719b13 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
719b13 |
(cherry picked from commit 4c2d0f6dca24f3396ab0718ad3f9f53cc53004df)
|
|
|
719b13 |
Signed-off-by: Leonardo Bras <leobras@redhat.com>
|
|
|
719b13 |
---
|
|
|
719b13 |
migration/ram.c | 23 ++++++++++++++---------
|
|
|
719b13 |
1 file changed, 14 insertions(+), 9 deletions(-)
|
|
|
719b13 |
|
|
|
719b13 |
diff --git a/migration/ram.c b/migration/ram.c
|
|
|
719b13 |
index 3e208efca7..3e82c4ff46 100644
|
|
|
719b13 |
--- a/migration/ram.c
|
|
|
719b13 |
+++ b/migration/ram.c
|
|
|
719b13 |
@@ -391,6 +391,11 @@ uint64_t ram_bytes_remaining(void)
|
|
|
719b13 |
|
|
|
719b13 |
MigrationStats ram_counters;
|
|
|
719b13 |
|
|
|
719b13 |
+static void ram_transferred_add(uint64_t bytes)
|
|
|
719b13 |
+{
|
|
|
719b13 |
+ ram_counters.transferred += bytes;
|
|
|
719b13 |
+}
|
|
|
719b13 |
+
|
|
|
719b13 |
/* used by the search for pages to send */
|
|
|
719b13 |
struct PageSearchStatus {
|
|
|
719b13 |
/* Current block being searched */
|
|
|
719b13 |
@@ -772,7 +777,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data,
|
|
|
719b13 |
* RAM_SAVE_FLAG_CONTINUE.
|
|
|
719b13 |
*/
|
|
|
719b13 |
xbzrle_counters.bytes += bytes_xbzrle - 8;
|
|
|
719b13 |
- ram_counters.transferred += bytes_xbzrle;
|
|
|
719b13 |
+ ram_transferred_add(bytes_xbzrle);
|
|
|
719b13 |
|
|
|
719b13 |
return 1;
|
|
|
719b13 |
}
|
|
|
719b13 |
@@ -1203,7 +1208,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block, ram_addr_t offset)
|
|
|
719b13 |
|
|
|
719b13 |
if (len) {
|
|
|
719b13 |
ram_counters.duplicate++;
|
|
|
719b13 |
- ram_counters.transferred += len;
|
|
|
719b13 |
+ ram_transferred_add(len);
|
|
|
719b13 |
return 1;
|
|
|
719b13 |
}
|
|
|
719b13 |
return -1;
|
|
|
719b13 |
@@ -1239,7 +1244,7 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
|
|
|
719b13 |
}
|
|
|
719b13 |
|
|
|
719b13 |
if (bytes_xmit) {
|
|
|
719b13 |
- ram_counters.transferred += bytes_xmit;
|
|
|
719b13 |
+ ram_transferred_add(bytes_xmit);
|
|
|
719b13 |
*pages = 1;
|
|
|
719b13 |
}
|
|
|
719b13 |
|
|
|
719b13 |
@@ -1270,8 +1275,8 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
|
|
|
719b13 |
static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
|
|
|
719b13 |
uint8_t *buf, bool async)
|
|
|
719b13 |
{
|
|
|
719b13 |
- ram_counters.transferred += save_page_header(rs, rs->f, block,
|
|
|
719b13 |
- offset | RAM_SAVE_FLAG_PAGE);
|
|
|
719b13 |
+ ram_transferred_add(save_page_header(rs, rs->f, block,
|
|
|
719b13 |
+ offset | RAM_SAVE_FLAG_PAGE));
|
|
|
719b13 |
if (async) {
|
|
|
719b13 |
qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE,
|
|
|
719b13 |
migrate_release_ram() &
|
|
|
719b13 |
@@ -1279,7 +1284,7 @@ static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
|
|
|
719b13 |
} else {
|
|
|
719b13 |
qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE);
|
|
|
719b13 |
}
|
|
|
719b13 |
- ram_counters.transferred += TARGET_PAGE_SIZE;
|
|
|
719b13 |
+ ram_transferred_add(TARGET_PAGE_SIZE);
|
|
|
719b13 |
ram_counters.normal++;
|
|
|
719b13 |
return 1;
|
|
|
719b13 |
}
|
|
|
719b13 |
@@ -1378,7 +1383,7 @@ exit:
|
|
|
719b13 |
static void
|
|
|
719b13 |
update_compress_thread_counts(const CompressParam *param, int bytes_xmit)
|
|
|
719b13 |
{
|
|
|
719b13 |
- ram_counters.transferred += bytes_xmit;
|
|
|
719b13 |
+ ram_transferred_add(bytes_xmit);
|
|
|
719b13 |
|
|
|
719b13 |
if (param->zero_page) {
|
|
|
719b13 |
ram_counters.duplicate++;
|
|
|
719b13 |
@@ -2303,7 +2308,7 @@ void acct_update_position(QEMUFile *f, size_t size, bool zero)
|
|
|
719b13 |
ram_counters.duplicate += pages;
|
|
|
719b13 |
} else {
|
|
|
719b13 |
ram_counters.normal += pages;
|
|
|
719b13 |
- ram_counters.transferred += size;
|
|
|
719b13 |
+ ram_transferred_add(size);
|
|
|
719b13 |
qemu_update_position(f, size);
|
|
|
719b13 |
}
|
|
|
719b13 |
}
|
|
|
719b13 |
@@ -3147,7 +3152,7 @@ out:
|
|
|
719b13 |
|
|
|
719b13 |
qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
|
|
|
719b13 |
qemu_fflush(f);
|
|
|
719b13 |
- ram_counters.transferred += 8;
|
|
|
719b13 |
+ ram_transferred_add(8);
|
|
|
719b13 |
|
|
|
719b13 |
ret = qemu_file_get_error(f);
|
|
|
719b13 |
}
|
|
|
719b13 |
--
|
|
|
719b13 |
2.35.3
|
|
|
719b13 |
|