qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
	<marcandre.lureau@redhat.com>,
	"Yuanhan Liu" <yuanhan.liu@linux.intel.com>,
	"Victor Kaplansky" <victork@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH] vhost-user-test: fix migration overlap test
Date: Thu, 26 Nov 2015 15:33:36 +0200	[thread overview]
Message-ID: <1448544806-15259-1-git-send-email-mst@redhat.com> (raw)

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 <mst@redhat.com>
---
 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);
 
-- 
MST

             reply	other threads:[~2015-11-26 13:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 13:33 Michael S. Tsirkin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-11-26 13:39 [Qemu-devel] [PATCH] vhost-user-test: fix migration overlap test Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448544806-15259-1-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=victork@redhat.com \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).