[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 21/30] migration/multifd: Support incoming fixed-ram strea
|
From: |
Fabiano Rosas |
|
Subject: |
[RFC PATCH v3 21/30] migration/multifd: Support incoming fixed-ram stream format |
|
Date: |
Mon, 27 Nov 2023 17:26:03 -0300 |
For the incoming fixed-ram migration we need to read the ramblock
headers, get the pages bitmap and send the host address of each
non-zero page to the multifd channel thread for writing.
To read from the migration file we need a preadv function that can
read into the iovs in segments of contiguous pages because (as in the
writing case) the file offset applies to the entire iovec.
Usage on HMP is:
(qemu) migrate_set_capability multifd on
(qemu) migrate_set_capability fixed-ram on
(qemu) migrate_set_parameter max-bandwidth 0
(qemu) migrate_set_parameter multifd-channels 8
(qemu) migrate_incoming file:migfile
(qemu) info status
(qemu) c
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/ram.c | 34 +++++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 385fe431bf..f5173755f0 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -111,6 +111,7 @@
* pages region in the migration file at a time.
*/
#define FIXED_RAM_LOAD_BUF_SIZE 0x100000
+#define FIXED_RAM_MULTIFD_LOAD_BUF_SIZE 0x100000
XBZRLECacheStats xbzrle_counters;
@@ -3942,13 +3943,36 @@ void colo_flush_ram_cache(void)
trace_colo_flush_ram_cache_end();
}
+static size_t ram_load_multifd_pages(RAMBlock *block, ram_addr_t start_offset,
+ size_t size)
+{
+ MultiFDRecvData *data = multifd_get_recv_data();
+
+ /*
+ * Pointing the opaque directly to the host buffer, no
+ * preprocessing needed.
+ */
+ data->opaque = block->host + start_offset;
+
+ data->file_offset = block->pages_offset + start_offset;
+ data->size = size;
+
+ if (multifd_recv() < 0) {
+ return -1;
+ }
+
+ return size;
+}
+
static void read_ramblock_fixed_ram(QEMUFile *f, RAMBlock *block,
long num_pages, unsigned long *bitmap)
{
unsigned long set_bit_idx, clear_bit_idx;
ram_addr_t offset;
void *host;
- size_t read, unread, size, buf_size = FIXED_RAM_LOAD_BUF_SIZE;
+ size_t read, unread, size;
+ size_t buf_size = (migrate_multifd() ? FIXED_RAM_MULTIFD_LOAD_BUF_SIZE :
+ FIXED_RAM_LOAD_BUF_SIZE);
for (set_bit_idx = find_first_bit(bitmap, num_pages);
set_bit_idx < num_pages;
@@ -3963,8 +3987,12 @@ static void read_ramblock_fixed_ram(QEMUFile *f,
RAMBlock *block,
host = host_from_ram_block_offset(block, offset);
size = MIN(unread, buf_size);
- read = qemu_get_buffer_at(f, host, size,
- block->pages_offset + offset);
+ if (migrate_multifd()) {
+ read = ram_load_multifd_pages(block, offset, size);
+ } else {
+ read = qemu_get_buffer_at(f, host, size,
+ block->pages_offset + offset);
+ }
offset += read;
unread -= read;
}
--
2.35.3
- [RFC PATCH v3 12/30] migration/multifd: Allow QIOTask error reporting without an object, (continued)
- [RFC PATCH v3 12/30] migration/multifd: Allow QIOTask error reporting without an object, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 11/30] migration/multifd: Allow multifd without packets, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 13/30] migration/multifd: Add outgoing QIOChannelFile support, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 14/30] migration/multifd: Add incoming QIOChannelFile support, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 15/30] io: Add a pwritev/preadv version that takes a discontiguous iovec, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 16/30] multifd: Rename MultiFDSendParams::data to compress_data, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 17/30] migration/multifd: Decouple recv method from pages, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 18/30] migration/multifd: Allow receiving pages without packets, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 19/30] migration/ram: Ignore multifd flush when doing fixed-ram migration, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 20/30] migration/multifd: Support outgoing fixed-ram stream format, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 21/30] migration/multifd: Support incoming fixed-ram stream format,
Fabiano Rosas <=
- [RFC PATCH v3 22/30] tests/qtest: Add a multifd + fixed-ram migration test, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 23/30] migration: Add direct-io parameter, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 24/30] tests/qtest: Add a test for migration with direct-io and multifd, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 25/30] monitor: Honor QMP request for fd removal immediately, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 26/30] monitor: Extract fdset fd flags comparison into a function, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 27/30] monitor: fdset: Match against O_DIRECT, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 28/30] docs/devel/migration.rst: Document the file transport, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 30/30] tests/qtest: Add a test for fixed-ram with passing of fds, Fabiano Rosas, 2023/11/27
- [RFC PATCH v3 29/30] migration: Add support for fdset with multifd + file, Fabiano Rosas, 2023/11/27