All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Alexey Perevalov <a.perevalov@samsung.com>
Cc: qemu-devel@nongnu.org, quintela@redhat.com, peterx@redhat.com,
	i.maximets@samsung.com, heetae82.ahn@samsung.com
Subject: Re: [Qemu-devel] [PATCH v11 5/6] migration: add blocktime calculation into postcopy-test
Date: Wed, 18 Oct 2017 20:09:53 +0100	[thread overview]
Message-ID: <20171018190953.GF2339@work-vm> (raw)
In-Reply-To: <1507202170-22619-6-git-send-email-a.perevalov@samsung.com>

* Alexey Perevalov (a.perevalov@samsung.com) wrote:
> This patch just requests blocktime calculation,
> and check it in case when UFFD_FEATURE_THREAD_ID feature is set
> on the host.
> 
> Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

(I preferred the bool got_stop and explicitly initialising it, because
if we add a 2nd test then it gets reset OK).

Dave
> ---
>  tests/postcopy-test.c | 63 +++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 48 insertions(+), 15 deletions(-)
> 
> diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c
> index 8142f2a..4231cce 100644
> --- a/tests/postcopy-test.c
> +++ b/tests/postcopy-test.c
> @@ -24,7 +24,8 @@
>  
>  const unsigned start_address = 1024 * 1024;
>  const unsigned end_address = 100 * 1024 * 1024;
> -bool got_stop;
> +static bool got_stop;
> +static bool uffd_feature_thread_id;
>  
>  #if defined(__linux__)
>  #include <sys/syscall.h>
> @@ -54,6 +55,7 @@ static bool ufd_version_check(void)
>          g_test_message("Skipping test: UFFDIO_API failed");
>          return false;
>      }
> +    uffd_feature_thread_id = api_struct.features & UFFD_FEATURE_THREAD_ID;
>  
>      ioctl_mask = (__u64)1 << _UFFDIO_REGISTER |
>                   (__u64)1 << _UFFDIO_UNREGISTER;
> @@ -265,22 +267,48 @@ static uint64_t get_migration_pass(void)
>      return result;
>  }
>  
> -static void wait_for_migration_complete(void)
> +static bool get_src_status(void)
>  {
>      QDict *rsp, *rsp_return;
> +    const char *status;
> +    bool result;
> +
> +    rsp = return_or_event(qmp("{ 'execute': 'query-migrate' }"));
> +    rsp_return = qdict_get_qdict(rsp, "return");
> +    status = qdict_get_str(rsp_return, "status");
> +    g_assert_cmpstr(status, !=,  "failed");
> +    result = strcmp(status, "completed") == 0;
> +    QDECREF(rsp);
> +    return result;
> +}
> +
> +static void read_blocktime(void)
> +{
> +    QDict *rsp, *rsp_return;
> +
> +    rsp = return_or_event(qmp("{ 'execute': 'query-migrate' }"));
> +    rsp_return = qdict_get_qdict(rsp, "return");
> +    g_assert(qdict_haskey(rsp_return, "postcopy-blocktime"));
> +    QDECREF(rsp);
> +}
> +
> +static void wait_for_migration_complete(QTestState *from, QTestState *to)
> +{
>      bool completed;
>  
>      do {
> -        const char *status;
> -
> -        rsp = return_or_event(qmp("{ 'execute': 'query-migrate' }"));
> -        rsp_return = qdict_get_qdict(rsp, "return");
> -        status = qdict_get_str(rsp_return, "status");
> -        completed = strcmp(status, "completed") == 0;
> -        g_assert_cmpstr(status, !=,  "failed");
> -        QDECREF(rsp);
> +
> +        /* test src state */
> +        global_qtest = from;
> +        completed = get_src_status();
> +
>          usleep(1000 * 100);
>      } while (!completed);
> +
> +    if (uffd_feature_thread_id) {
> +        global_qtest = to;
> +        read_blocktime();
> +    }
>  }
>  
>  static void wait_for_migration_pass(void)
> @@ -364,8 +392,6 @@ static void test_migrate(void)
>      char *bootpath = g_strdup_printf("%s/bootsect", tmpfs);
>      const char *arch = qtest_get_arch();
>  
> -    got_stop = false;
> -
>      if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
>          init_bootfile_x86(bootpath);
>          cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 150M"
> @@ -425,6 +451,15 @@ static void test_migrate(void)
>      g_assert(qdict_haskey(rsp, "return"));
>      QDECREF(rsp);
>  
> +    global_qtest = to;
> +    rsp = qmp("{ 'execute': 'migrate-set-capabilities',"
> +                  "'arguments': { "
> +                      "'capabilities': [ {"
> +                          "'capability': 'postcopy-blocktime',"
> +                          "'state': true } ] } }");
> +    g_assert(qdict_haskey(rsp, "return"));
> +    QDECREF(rsp);
> +
>      /* We want to pick a speed slow enough that the test completes
>       * quickly, but that it doesn't complete precopy even on a slow
>       * machine, so also set the downtime.
> @@ -441,7 +476,6 @@ static void test_migrate(void)
>      g_assert(qdict_haskey(rsp, "return"));
>      QDECREF(rsp);
>  
> -
>      /* Wait for the first serial output from the source */
>      wait_for_serial("src_serial");
>  
> @@ -467,8 +501,7 @@ static void test_migrate(void)
>      qmp_eventwait("RESUME");
>  
>      wait_for_serial("dest_serial");
> -    global_qtest = from;
> -    wait_for_migration_complete();
> +    wait_for_migration_complete(from, to);
>  
>      qtest_quit(from);
>  
> -- 
> 2.7.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-10-18 19:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171005111622eucas1p2093fedb3a69ca522d6b8260377b75419@eucas1p2.samsung.com>
2017-10-05 11:16 ` [Qemu-devel] [PATCH v11 0/6] calculate blocktime for postcopy live migration Alexey Perevalov
2017-10-05 11:16   ` [Qemu-devel] [PATCH v11 1/6] migration: introduce postcopy-blocktime capability Alexey Perevalov
2017-10-05 11:16   ` [Qemu-devel] [PATCH v11 2/6] migration: add postcopy blocktime ctx into MigrationIncomingState Alexey Perevalov
2017-10-18 11:21     ` Dr. David Alan Gilbert
2017-10-05 11:16   ` [Qemu-devel] [PATCH v11 3/6] migration: calculate vCPU blocktime on dst side Alexey Perevalov
2017-10-18 18:59     ` Dr. David Alan Gilbert
2017-10-19  8:48       ` Alexey Perevalov
2017-10-19  8:58         ` Dr. David Alan Gilbert
2017-10-05 11:16   ` [Qemu-devel] [PATCH v11 4/6] migration: postcopy_blocktime documentation Alexey Perevalov
2017-10-05 11:16   ` [Qemu-devel] [PATCH v11 5/6] migration: add blocktime calculation into postcopy-test Alexey Perevalov
2017-10-18 19:09     ` Dr. David Alan Gilbert [this message]
2017-10-05 11:16   ` [Qemu-devel] [PATCH v11 6/6] migration: add postcopy total blocktime into query-migrate Alexey Perevalov

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=20171018190953.GF2339@work-vm \
    --to=dgilbert@redhat.com \
    --cc=a.perevalov@samsung.com \
    --cc=heetae82.ahn@samsung.com \
    --cc=i.maximets@samsung.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.