[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/16] migration: Test new fd infrastructure
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 14/16] migration: Test new fd infrastructure |
Date: |
Mon, 13 Mar 2017 13:44:32 +0100 |
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 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/migration/ram.c b/migration/ram.c
index 3b1a2dc..32cc678 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -476,8 +476,26 @@ static void *multifd_send_thread(void *opaque)
break;
}
if (p->pages.num) {
+ int i;
+ int num;
+
+ num = p->pages.num;
p->pages.num = 0;
qemu_mutex_unlock(&p->mutex);
+
+ for (i = 0; i < num; i++) {
+ if (qio_channel_write(p->c,
+ (const char *)&p->pages.iov[i].iov_base,
+ sizeof(uint8_t *), &error_abort)
+ != sizeof(uint8_t *)) {
+ MigrationState *s = migrate_get_current();
+
+ migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+ MIGRATION_STATUS_FAILED);
+ terminate_multifd_send_threads();
+ return NULL;
+ }
+ }
qemu_mutex_lock(&multifd_send_state->mutex);
p->done = true;
qemu_mutex_unlock(&multifd_send_state->mutex);
@@ -645,6 +663,7 @@ void migrate_multifd_recv_threads_join(void)
static void *multifd_recv_thread(void *opaque)
{
MultiFDRecvParams *p = opaque;
+ uint8_t *recv_address;
char start;
qio_channel_read(p->c, &start, 1, &error_abort);
@@ -658,7 +677,38 @@ static void *multifd_recv_thread(void *opaque)
break;
}
if (p->pages.num) {
+ int i;
+ int num;
+
+ num = p->pages.num;
p->pages.num = 0;
+
+ for (i = 0; i < num; i++) {
+ if (qio_channel_read(p->c,
+ (char *)&recv_address,
+ sizeof(uint8_t *), &error_abort)
+ != sizeof(uint8_t *)) {
+ MigrationState *s = migrate_get_current();
+
+ migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+ MIGRATION_STATUS_FAILED);
+ terminate_multifd_recv_threads();
+ return NULL;
+ }
+ if (recv_address != p->pages.iov[i].iov_base) {
+ MigrationState *s = migrate_get_current();
+
+ printf("We received %p what we were expecting %p (%d)\n",
+ recv_address,
+ p->pages.iov[i].iov_base, i);
+
+ migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE,
+ MIGRATION_STATUS_FAILED);
+ terminate_multifd_recv_threads();
+ return NULL;
+ }
+ }
+
p->done = true;
qemu_mutex_unlock(&p->mutex);
qemu_sem_post(&p->ready);
--
2.9.3
- Re: [Qemu-devel] [PATCH 06/16] migration: Create x-multifd-threads parameter, (continued)
[Qemu-devel] [PATCH 10/16] migration: Create ram_multifd_page, Juan Quintela, 2017/03/13
[Qemu-devel] [PATCH 11/16] migration: Really use multiple pages at a time, Juan Quintela, 2017/03/13
[Qemu-devel] [PATCH 12/16] migration: Send the fd number which we are going to use for this page, Juan Quintela, 2017/03/13
[Qemu-devel] [PATCH 14/16] migration: Test new fd infrastructure,
Juan Quintela <=
[Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Juan Quintela, 2017/03/13
- Re: [Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Paolo Bonzini, 2017/03/14
- Re: [Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Dr. David Alan Gilbert, 2017/03/17
- Re: [Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Paolo Bonzini, 2017/03/17
- Re: [Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Dr. David Alan Gilbert, 2017/03/17
- Re: [Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Paolo Bonzini, 2017/03/20
- Re: [Qemu-devel] [PATCH 13/16] migration: Create thread infrastructure for multifd recv side, Juan Quintela, 2017/03/30
[Qemu-devel] [PATCH 16/16] migration: Flush receive queue, Juan Quintela, 2017/03/13
[Qemu-devel] [PATCH 15/16] migration: Transfer pages over new channels, Juan Quintela, 2017/03/13
Re: [Qemu-devel] [PATCH 00/16] Multifd v4, Dr. David Alan Gilbert, 2017/03/14