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