[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/13] migration: Test new fd infrastructure
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 11/13] migration: Test new fd infrastructure |
Date: |
Fri, 21 Oct 2016 21:42:13 +0200 |
We just send the address through the alternate channels and test that it
is ok.
Signed-off-by: Juan Quintela <address@hidden>
---
migration/ram.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/migration/ram.c b/migration/ram.c
index 294a99e..2ead443 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -421,6 +421,7 @@ QemuCond multifd_send_cond;
static void *multifd_send_thread(void *opaque)
{
MultiFDSendParams *params = opaque;
+ uint8_t *address;
char start = 's';
qio_channel_write(params->c, &start, 1, &error_abort);
@@ -432,8 +433,16 @@ static void *multifd_send_thread(void *opaque)
qemu_mutex_lock(¶ms->mutex);
while (!params->quit){
if (params->address) {
+ address = params->address;
params->address = 0;
qemu_mutex_unlock(¶ms->mutex);
+
+ if (qio_channel_write(params->c, (const char *)&address,
+ sizeof(uint8_t *), &error_abort)
+ != sizeof(uint8_t*)) {
+ /* Shuoudn't ever happen */
+ exit(-1);
+ }
qemu_mutex_lock(&multifd_send_mutex);
params->done = true;
qemu_cond_signal(&multifd_send_cond);
@@ -565,6 +574,8 @@ QemuCond multifd_recv_cond;
static void *multifd_recv_thread(void *opaque)
{
MultiFDRecvParams *params = opaque;
+ uint8_t *address;
+ uint8_t *recv_address;
char start;
qio_channel_read(params->c, &start, 1, &error_abort);
@@ -576,8 +587,23 @@ static void *multifd_recv_thread(void *opaque)
qemu_mutex_lock(¶ms->mutex);
while (!params->quit){
if (params->address) {
+ address = params->address;
params->address = 0;
qemu_mutex_unlock(¶ms->mutex);
+
+ if (qio_channel_read(params->c, (char *)&recv_address,
+ sizeof(uint8_t*), &error_abort)
+ != sizeof(uint8_t *)) {
+ /* shouldn't ever happen */
+ exit(-1);
+ }
+
+ if (address != recv_address) {
+ printf("We received %p what we were expecting %p\n",
+ recv_address, address);
+ exit(-1);
+ }
+
qemu_mutex_lock(&multifd_recv_mutex);
params->done = true;
qemu_cond_signal(&multifd_recv_cond);
@@ -2888,10 +2914,6 @@ static int ram_load(QEMUFile *f, void *opaque, int
version_id)
case RAM_SAVE_FLAG_MULTIFD_PAGE:
fd_num = qemu_get_be16(f);
- if (fd_num != 0) {
- /* this is yet an unused variable, changed later */
- fd_num = 0;
- }
multifd_recv_page(host, fd_num);
qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
break;
--
2.7.4
- Re: [Qemu-devel] [PATCH 04/13] migration: Create x-multifd-threads parameter, (continued)
- [Qemu-devel] [PATCH 01/13] migration: create Migration Incoming State at init time, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 05/13] migration: create multifd migration threads, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 06/13] migration: Start of multiple fd work, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 07/13] migration: create ram_multifd_page, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 09/13] migration: Send the fd number which we are going to use for this page, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 08/13] migration: Create thread infrastructure for multifd send side, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 11/13] migration: Test new fd infrastructure,
Juan Quintela <=
- [Qemu-devel] [PATCH 10/13] migration: Create thread infrastructure for multifd recv side, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 12/13] migration: [HACK]Transfer pages over new channels, Juan Quintela, 2016/10/21
- [Qemu-devel] [PATCH 13/13] migration: flush receive queue, Juan Quintela, 2016/10/21
- Re: [Qemu-devel] [RFC 00/13] Multifd v2, no-reply, 2016/10/21