[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 15/19] migration/rdma: Unfold hook_ram_load()
From: |
Juan Quintela |
Subject: |
[PATCH 15/19] migration/rdma: Unfold hook_ram_load() |
Date: |
Thu, 27 Apr 2023 18:34:45 +0200 |
There is only one flag called with: RAM_CONTROL_BLOCK_REG.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/qemu-file.c | 10 ----------
migration/qemu-file.h | 11 -----------
migration/ram.c | 6 ++++--
migration/rdma.c | 25 +++++--------------------
migration/rdma.h | 2 ++
5 files changed, 11 insertions(+), 43 deletions(-)
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 014db96984..9d86900efe 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -315,16 +315,6 @@ void qemu_fflush(QEMUFile *f)
f->iovcnt = 0;
}
-void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data)
-{
- if (f->hooks && f->hooks->hook_ram_load) {
- int ret = f->hooks->hook_ram_load(f, flags, data);
- if (ret < 0) {
- qemu_file_set_error(f, ret);
- }
- }
-}
-
size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
ram_addr_t offset, size_t size,
uint64_t *bytes_sent)
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 7623e3c475..d69f5d65e8 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -29,20 +29,12 @@
#include "exec/cpu-common.h"
#include "io/channel.h"
-/*
- * This function provides hooks around different
- * stages of RAM migration.
- * 'data' is call specific data associated with the 'flags' value
- */
-typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags, void *data);
-
/*
* Constants used by ram_control_* hooks
*/
#define RAM_CONTROL_SETUP 0
#define RAM_CONTROL_ROUND 1
#define RAM_CONTROL_FINISH 3
-#define RAM_CONTROL_BLOCK_REG 4
/*
* This function allows override of where the RAM page
@@ -55,7 +47,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f,
uint64_t *bytes_sent);
typedef struct QEMUFileHooks {
- QEMURamHookFunc *hook_ram_load;
QEMURamSaveFunc *save_page;
} QEMUFileHooks;
@@ -147,8 +138,6 @@ void qemu_fflush(QEMUFile *f);
void qemu_file_set_blocking(QEMUFile *f, bool block);
int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size);
-void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data);
-
/* Whenever this is found in the data stream, the flags
* will be passed to ram_control_load_hook in the incoming-migration
* side. This lets before_ram_iterate/after_ram_iterate add
diff --git a/migration/ram.c b/migration/ram.c
index c0110ca8cb..d29dd67d5f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4418,8 +4418,10 @@ static int ram_load_precopy(QEMUFile *f)
ret = -EINVAL;
}
}
- ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG,
- block->idstr);
+ ret = rdma_block_notification_handle(f, block->idstr);
+ if (ret < 0) {
+ qemu_file_set_error(f, ret);
+ }
} else {
error_report("Unknown ramblock \"%s\", cannot "
"accept migration", id);
diff --git a/migration/rdma.c b/migration/rdma.c
index e72584483a..72ea08ee95 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3804,14 +3804,12 @@ out:
}
/* Destination:
- * Called via a ram_control_load_hook during the initial RAM load section which
- * lists the RAMBlocks by name. This lets us know the order of the RAMBlocks
- * on the source.
- * We've already built our local RAMBlock list, but not yet sent the list to
- * the source.
+ * Called during the initial RAM load section which lists the
+ * RAMBlocks by name. This lets us know the order of the RAMBlocks on
+ * the source. We've already built our local RAMBlock list, but not
+ * yet sent the list to the source.
*/
-static int
-rdma_block_notification_handle(QEMUFile *f, const char *name)
+int rdma_block_notification_handle(QEMUFile *f, const char *name)
{
RDMAContext *rdma;
QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
@@ -3845,18 +3843,6 @@ rdma_block_notification_handle(QEMUFile *f, const char
*name)
return 0;
}
-static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data)
-{
- switch (flags) {
- case RAM_CONTROL_BLOCK_REG:
- return rdma_block_notification_handle(f, data);
-
- default:
- /* Shouldn't be called with any other values */
- abort();
- }
-}
-
int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags)
{
QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f));
@@ -3995,7 +3981,6 @@ err:
}
static const QEMUFileHooks rdma_read_hooks = {
- .hook_ram_load = rdma_load_hook,
};
static const QEMUFileHooks rdma_write_hooks = {
diff --git a/migration/rdma.h b/migration/rdma.h
index 8d0253047c..1266a90e07 100644
--- a/migration/rdma.h
+++ b/migration/rdma.h
@@ -27,9 +27,11 @@ void rdma_start_incoming_migration(const char *host_port,
Error **errp);
int qemu_rdma_registration_handle(QEMUFile *f);
int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags);
int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags);
+int rdma_block_notification_handle(QEMUFile *f, const char *name);
#else
int qemu_rdma_registration_handle(QEMUFile *f) { return 0; }
int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; }
int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; }
+int rdma_block_notification_handle(QEMUFile *f, const char *name) { return 0; }
#endif
#endif
--
2.40.0
- [PATCH 13/19] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry, (continued)
- [PATCH 13/19] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry, Juan Quintela, 2023/04/27
- [PATCH 14/19] migration/rdma: Remove all uses of RAM_CONTROL_HOOK, Juan Quintela, 2023/04/27
- [PATCH 17/19] migration/rdma: Create rdma_control_save_page(), Juan Quintela, 2023/04/27
- [PATCH 19/19] migration/rdma: Move rdma constants from qemu-file.h to rdma.h, Juan Quintela, 2023/04/27
- [PATCH 11/19] migration/rdma: We can calculate the rioc from the QEMUFile, Juan Quintela, 2023/04/27
- [PATCH 03/19] migration: Rename ram_counters to mig_stats, Juan Quintela, 2023/04/27
- [PATCH 18/19] qemu-file: Remove QEMUFileHooks, Juan Quintela, 2023/04/27
- [PATCH 16/19] migration/rdma: Make ram_control_save_page() use exported interfaces, Juan Quintela, 2023/04/27
- [PATCH 10/19] migration/rdma: Don't pass the QIOChannelRDMA as an opaque, Juan Quintela, 2023/04/27
- [PATCH 15/19] migration/rdma: Unfold hook_ram_load(),
Juan Quintela <=
- [PATCH 08/19] migration/rdma: Unflod ram_control_after_iterate(), Juan Quintela, 2023/04/27