From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1zeu-0006WC-Ls for qemu-devel@nongnu.org; Thu, 26 Nov 2015 11:44:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1zet-0007YC-Sh for qemu-devel@nongnu.org; Thu, 26 Nov 2015 11:44:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1zet-0007Y8-N7 for qemu-devel@nongnu.org; Thu, 26 Nov 2015 11:44:35 -0500 Date: Thu, 26 Nov 2015 18:44:31 +0200 From: "Michael S. Tsirkin" Message-ID: <1448556198-25213-10-git-send-email-mst@redhat.com> References: <1448556198-25213-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1448556198-25213-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 9/9] vhost-user-test: fix migration overlap test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Peter Maydell , Yuanhan Liu , Victor Kaplansky , =?us-ascii?B?PT9VVEYtOD9xP01hcmMtQW5kcj1DMz1BOT0yMEx1cmVhdT89?= During migration, source does GET_BASE, destination does SET_BASE. Use that as opposed to fds being configured to detect vhost user running on both source and destination. Signed-off-by: Michael S. Tsirkin --- tests/vhost-user-test.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 022223b..e4c36af 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -131,6 +131,7 @@ typedef struct TestServer { GMutex data_mutex; GCond data_cond; int log_fd; + uint64_t rings; } TestServer; #if !GLIB_CHECK_VERSION(2, 32, 0) @@ -279,6 +280,9 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) msg.payload.state.num = 0; p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); + + assert(msg.payload.state.index < 2); + s->rings &= ~(0x1ULL << msg.payload.state.index); break; case VHOST_USER_SET_MEM_TABLE: @@ -316,10 +320,9 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) g_cond_signal(&s->data_cond); break; - case VHOST_USER_SET_VRING_ENABLE: - if (!msg.payload.state.num) { - s->fds_num = 0; - } + case VHOST_USER_SET_VRING_BASE: + assert(msg.payload.state.index < 2); + s->rings |= 0x1ULL << msg.payload.state.index; break; default: @@ -486,7 +489,7 @@ static gboolean test_migrate_source_check(GSource *source) { TestMigrateSource *t = (TestMigrateSource *)source; - gboolean overlap = t->src->fds_num > 0 && t->dest->fds_num > 0; + gboolean overlap = t->src->rings && t->dest->rings; g_assert(!overlap); -- MST