* On Fri, Apr 29, 2011 at 02:42:20AM -0300, Lucas Meneghel Rodrigues wrote:
> On Thu, Apr 21, 2011 at 4:33 AM, Amos Kong <[email protected]> wrote:
> > This case is used to test the drift between host and guest.
> > Use taskset to make tsc program execute in a single cpu.
> > If the drift ratio bigger than 10%, then fail this case.
>
> The calculations of the tsc frequency looks wrong... See comments below.
>
> Also, when Glauber or Zach could take a look into this test it'd be great!
>
> > Signed-off-by: Amos Kong <[email protected]>
> > ---
> > ?client/tests/kvm/deps/get_tsc.c ? ? ? ?| ? 27 ++++++++++
> > ?client/tests/kvm/tests/tsc_drift.py ? ?| ? 88
> > ++++++++++++++++++++++++++++++++
> > ?client/tests/kvm/tests_base.cfg.sample | ? ?5 ++
> > ?3 files changed, 120 insertions(+), 0 deletions(-)
> > ?create mode 100644 client/tests/kvm/deps/get_tsc.c
> > ?create mode 100644 client/tests/kvm/tests/tsc_drift.py
...
> > + ? ? ? ?delta = tsc2 - tsc1
> > + ? ? ? ?logging.info("Host TSC delta for cpu %s is %s" % (i, delta))
> > + ? ? ? ?if delta < 0:
> > + ? ? ? ? ? ?raise error.TestError("Host TSC for cpu %s warps %s" % (i,
> > delta))
>
> ^ Yeah, I don't think this is expected to warp, but yet, good to check.
>
> > + ? ? ? ?host_freq += delta / ncpu
>
> Now, i really didn't understand the concept behind the tsc frequency.
> So we have a difference between 2 timestamps taken over an arbitrary
> period of time (in this case, looks 30s by default) and divide by the
> number of cpus, however we will repeat this procedure by the same
> amount so:
>
> N * ( d_tsc1/N + d_tsc2/N + d_tsc3/N + ... + d_tscn/N)
^ ?
I call it 'frequency' because the interval is fixed (30 seconds)
1) get a average tsc increment of host cpus in 30s
host_freq = ( d_tsc1/N + d_tsc2/N + d_tsc3/N + ... + d_tscn/N)
= ( d_tsc1 + d_tsc2 + d_tsc3 + ... + d_tscn)/N
2) get tsc increment of each vcpus in 30s
d_tsc_vcpu1
d_tsc_vcpu2
...
d_tsc_vcpuN
3) compare 'd_tsc_vcpu1' with 'host_freq'
ratio = (d_tsc_vcpu1 - host_freq) / host_freq
if ratio larger than 10%, then fail this test.
ratio = (d_tsc_vcpu2 - host_freq) / host_freq
if ratio larger than 10%, then fail this test.
...
Have talked with jason, I'll try to write a kvm-unit test for this testcase.
> This could be simplified to
>
> (d_tsc1 + d_tsc2 + d_tsc3 +.... + d_tscn)
>
> Unless I'm missing something... so
>
> host_freq = sum(d_tsci)
>
> The calculation could be simplified then... And by definition, isn't
> frequency how many times a phenomena occurs (in this case, change of
> timestamp counter) per time? So, don't we have to divide this sum by
> the time the program slept? Also, it looks like the whole logic to get
> the frequencies can be factored to a single function and just call
> that function for guest and host.
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest