From patchwork Thu Nov 26 13:33:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 549105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E3D941402A5 for ; Fri, 27 Nov 2015 00:34:01 +1100 (AEDT) Received: from localhost ([::1]:51253 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1wgR-0002wz-F3 for incoming@patchwork.ozlabs.org; Thu, 26 Nov 2015 08:33:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1wgB-0002gD-R7 for qemu-devel@nongnu.org; Thu, 26 Nov 2015 08:33:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1wg8-0007Bn-Fs for qemu-devel@nongnu.org; Thu, 26 Nov 2015 08:33:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1wg8-0007Bj-Au for qemu-devel@nongnu.org; Thu, 26 Nov 2015 08:33:40 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id C1D8F8F283; Thu, 26 Nov 2015 13:33:39 +0000 (UTC) Received: from redhat.com (ovpn-116-104.ams2.redhat.com [10.36.116.104]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id tAQDXalS020233; Thu, 26 Nov 2015 08:33:37 -0500 Date: Thu, 26 Nov 2015 15:33:36 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1448544806-15259-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: =?us-ascii?B?PT9VVEYtOD9xP01hcmMtQW5kcj1DMz1BOT0yMEx1cmVhdT89?= , Yuanhan Liu , Victor Kaplansky , Paolo Bonzini Subject: [Qemu-devel] [PATCH] vhost-user-test: fix migration overlap test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 78aac92..4975b9b 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);