[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/5] migration: implement the get_return_path for RD
From: |
Lidong Chen |
Subject: |
[Qemu-devel] [PATCH 3/5] migration: implement the get_return_path for RDMA iochannel |
Date: |
Sat, 7 Apr 2018 16:26:32 +0800 |
the default get_return_path function does not work for RDMA live
migration, the patch implement the get_return_path for RDMA iochannel.
Signed-off-by: Lidong Chen <address@hidden>
---
migration/rdma.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/migration/rdma.c b/migration/rdma.c
index 230bd97..53773c7 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3638,6 +3638,40 @@ err:
return ret;
}
+static QEMUFile *qio_channel_rdma_get_return_path(void *opaque, int input)
+{
+ QIOChannel *ioc = opaque;
+ QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(ioc);
+ RDMAContext *rdma = rioc->rdma;
+
+ QIOChannelRDMA *rioc_return_path;
+ RDMAContext *rdma_return_path = rdma->return_path;
+
+ if (!rdma_return_path) {
+ return NULL;
+ }
+
+ rioc_return_path = QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_RDMA));
+ rioc_return_path->rdma = rdma_return_path;
+ if (input) {
+ rioc_return_path->file = qemu_fopen_channel_output(
+ QIO_CHANNEL(rioc_return_path));
+ } else {
+ rioc_return_path->file = qemu_fopen_channel_input(
+ QIO_CHANNEL(rioc_return_path));
+ }
+ return rioc_return_path->file;
+}
+
+static QEMUFile *qio_channel_rdma_get_output_return_path(void *opaque)
+{
+ return qio_channel_rdma_get_return_path(opaque, 0);
+}
+
+static QEMUFile *qio_channel_rdma_get_input_return_path(void *opaque)
+{
+ return qio_channel_rdma_get_return_path(opaque, 1);
+}
static const QEMUFileHooks rdma_read_hooks = {
.hook_ram_load = rdma_load_hook,
};
@@ -3700,9 +3734,13 @@ static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma,
const char *mode)
if (mode[0] == 'w') {
rioc->file = qemu_fopen_channel_output(QIO_CHANNEL(rioc));
qemu_file_set_hooks(rioc->file, &rdma_write_hooks);
+ qemu_file_set_return_path(rioc->file,
+ qio_channel_rdma_get_output_return_path);
} else {
rioc->file = qemu_fopen_channel_input(QIO_CHANNEL(rioc));
qemu_file_set_hooks(rioc->file, &rdma_read_hooks);
+ qemu_file_set_return_path(rioc->file,
+ qio_channel_rdma_get_input_return_path);
}
return rioc->file;
--
1.8.3.1
[Qemu-devel] [PATCH 5/5] migration: disable RDMA WRITR after postcopy started., Lidong Chen, 2018/04/07
Re: [Qemu-devel] [PATCH 0/5] Enable postcopy RDMA live migration, 858585 jemmy, 2018/04/08
Re: [Qemu-devel] [PATCH 0/5] Enable postcopy RDMA live migration, Dr. David Alan Gilbert, 2018/04/11