All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: mtosatti@redhat.com, avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-test 6/6] Add a test for kvm-clock
Date: Fri, 27 Aug 2010 08:34:56 -0300	[thread overview]
Message-ID: <20100827113456.GM2985@mothafucka.localdomain> (raw)
In-Reply-To: <20100827054953.7409.25948.stgit@FreeLancer>

On Fri, Aug 27, 2010 at 01:49:53PM +0800, Jason Wang wrote:
> This patch implements two tests for kvmclock. First one check whether
> the date of time returned by kvmclock matches the value got from
> host. Second one check whether the cycle of kvmclock grows
> monotonically in smp guest.
> 
> Three parameters were accepted by the test: test loops, seconds
> since 1970-01-01 00:00:00 UTC which could be easily get through date
> +%s and the max accepted offset value between the tod of guest and
> host.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  config-x86-common.mak |    6 ++
>  x86/README            |    2 +
>  x86/kvmclock_test.c   |  145 +++++++++++++++++++++++++++++++++++++++++++++++++
>  x86/unittests.cfg     |    5 ++
>  4 files changed, 157 insertions(+), 1 deletions(-)
>  create mode 100644 x86/kvmclock_test.c
> 
> diff --git a/config-x86-common.mak b/config-x86-common.mak
> index b8ca859..b541c1c 100644
> --- a/config-x86-common.mak
> +++ b/config-x86-common.mak
> @@ -26,7 +26,8 @@ FLATLIBS = lib/libcflat.a $(libgcc)
>  tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
>                 $(TEST_DIR)/smptest.flat  $(TEST_DIR)/port80.flat \
>                 $(TEST_DIR)/realmode.flat $(TEST_DIR)/msr.flat \
> -               $(TEST_DIR)/hypercall.flat $(TEST_DIR)/sieve.flat
> +               $(TEST_DIR)/hypercall.flat $(TEST_DIR)/sieve.flat \
> +               $(TEST_DIR)/kvmclock_test.flat
>  
>  tests_and_config = $(TEST_DIR)/*.flat $(TEST_DIR)/unittests.cfg
>  
> @@ -70,6 +71,9 @@ $(TEST_DIR)/rmap_chain.flat: $(cstart.o) $(TEST_DIR)/rmap_chain.o \
>  
>  $(TEST_DIR)/svm.flat: $(cstart.o) $(TEST_DIR)/vm.o
>  
> +$(TEST_DIR)/kvmclock_test.flat: $(cstart.o) $(TEST_DIR)/kvmclock.o \
> +                                $(TEST_DIR)/kvmclock_test.o
> +
>  arch_clean:
>  	$(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat \
>  	$(TEST_DIR)/.*.d $(TEST_DIR)/lib/.*.d $(TEST_DIR)/lib/*.o
> diff --git a/x86/README b/x86/README
> index ab5a2ae..4b90080 100644
> --- a/x86/README
> +++ b/x86/README
> @@ -12,3 +12,5 @@ sieve: heavy memory access with no paging and with paging static and with paging
>  smptest: run smp_id() on every cpu and compares return value to number
>  tsc: write to tsc(0) and write to tsc(100000000000) and read it back
>  vmexit: long loops for each: cpuid, vmcall, mov_from_cr8, mov_to_cr8, inl_pmtimer, ipi, ipi+halt
> +kvmclock_test: monotonic cycle test of kvmclock and a sanity test of
> +wallclock
> diff --git a/x86/kvmclock_test.c b/x86/kvmclock_test.c
> new file mode 100644
> index 0000000..cd80915
> --- /dev/null
> +++ b/x86/kvmclock_test.c
> @@ -0,0 +1,145 @@
> +#include "libcflat.h"
> +#include "smp.h"
> +#include "atomic.h"
> +#include "string.h"
> +#include "kvmclock.h"
> +
> +#define DEFAULT_TEST_LOOPS 100000000L
> +#define DEFAULT_THRESHOLD  60L
> +
> +        printf("Check the stability of raw cycle\n");
> +        pvclock_set_flags(PVCLOCK_TSC_STABLE_BIT
> +                          | PVCLOCK_RAW_CYCLE_BIT);
> +        if (cycle_test(ncpus, loops, &ti[1]))
> +                printf("Raw cycle is not stable\n");
> +        else
> +                printf("Raw cycle is stable\n");
> +
> +        pvclock_set_flags(PVCLOCK_TSC_STABLE_BIT);
> +        printf("Monotonic cycle test:\n");
> +        nerr += cycle_test(ncpus, loops, &ti[0]);
> +
> +        for (i = 0; i < ncpus; ++i)
> +                on_cpu(i, kvm_clock_clear, (void *)0);
> +
> +        return nerr > 0 ? 1 : 0;

another interesting bit of information is the total time taken by
the first cycle_test, compared to the second (They do the same amount
of loops anyway, so no need for further math). We are all pretty sure
the lack of a stable bit will influence kvm clock performance, but
nobody measured by how much yet (in big, big boxes.)

  parent reply	other threads:[~2010-08-27 11:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-27  5:49 [PATCH kvm-unit-test 0/6] Kvmclock test Jason Wang
2010-08-27  5:49 ` [PATCH kvm-unit-test 1/6] Introduce memory barriers Jason Wang
2010-08-27  5:49 ` [PATCH kvm-unit-test 2/6] Introduce atomic operations Jason Wang
2010-08-27 11:39   ` Glauber Costa
2010-08-29  9:39     ` Avi Kivity
2010-08-27  5:49 ` [PATCH kvm-unit-test 3/6] Export tsc related helpers Jason Wang
2010-08-27  5:49 ` [PATCH kvm-unit-test 4/6] Introduce atol() Jason Wang
2010-08-27  5:49 ` [PATCH kvm-unit-test 5/6] Add a simple kvmclock driver Jason Wang
2010-08-27 11:31   ` Glauber Costa
2010-08-27  5:49 ` [PATCH kvm-unit-test 6/6] Add a test for kvm-clock Jason Wang
2010-08-27 11:27   ` Glauber Costa
2010-08-30  3:07     ` Jason Wang
2010-08-27 11:34   ` Glauber Costa [this message]
2010-08-30  3:27     ` Jason Wang
2010-08-28  1:58   ` Zachary Amsden
     [not found] <18442408.826301283138927321.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
2010-08-30  3:29 ` Jason Wang

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=20100827113456.GM2985@mothafucka.localdomain \
    --to=glommer@redhat.com \
    --cc=avi@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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.