Skip to contentSkip to conversation

KVM test: Add monotonic_time into the guest test

PATCH In review Jason Wang 2 participants 9 messages Mar 22, 2010 – Mar 26, 2010 KVM

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/4 KVM test: Add monotonic_time into the guest test

Monotonic_time is used to test gettimeofday(), TSC and clock_gettime(CLOCK_MONOTONIC) which is useful to test the virutal timer device.

---
 .../kvm/autotest_control/monotonic_time.control    |   37 ++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample             |    3 ++
 2 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/autotest_control/monotonic_time.control
client/tests/kvm/autotest_control/monotonic_time.control new file +37 -0
new file mode 100644
index 0000000..4dbfec4
@@ -0,0 +1,37 @@
+NAME = 'monotonic_time'
+AUTHOR = 'Michael Davidson <[email protected]>'
+TIME = 'MEDIUM'
+TEST_CLASS = 'Kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+DOC = """
+monotonic_time checks various time interfaces:
+  gettimeofday()
+  clock_gettime(CLOCK_MONTONIC)
+  TSC
+for monotonicity.
+
+Based on time-warp-test.c by Ingo Molnar.
+"""
+
+#
+# Test gettimeofday(), TSC, and clock_gettime(CLOCK_MONOTONIC)
+#
+# Tests run for 'duration' seconds and check that the selected
+# time interface does not go backwards by more than 'threshold'.
+#
+# Note that the threshold value has the same resolution as the
+# clock source:
+#   gettimeofday()                 - microseconds
+#   clock_gettime(CLOCK_MONOTONIC) - nanoseconds
+#   TSC                            - CPU clock cycles
+#
+#
+job.run_test('monotonic_time', tag='gtod',  test_type='gtod',
+             duration=300, threshold=0)
+
+job.run_test('monotonic_time', tag='clock', test_type='clock',
+             duration=300, threshold=0)
+
+job.run_test('monotonic_time', tag='tsc',   test_type='tsc',
+             duration=300, threshold=0)
client/tests/kvm/tests_base.cfg.sample +3 -0
index 9963a44..2af6a05 100644
@@ -133,6 +133,9 @@ variants:
             - cpu_hotplug:
                 test_name = cpu_hotplug
                 test_control_file = cpu_hotplug.control
+            - monotonic_time:
+                test_name = monotonic_time
+                test_control_file = monotonic_time.control
 
     - linux_s3:     install setup unattended_install
         type = linux_s3
author
#1 lore raw

PATCH 2/4 KVM test: Add TSC into guest test

TSC is used to check the whether the TSC of processors are synchronized which is useful for testing virtual TSC.

---
 client/tests/kvm/autotest_control/tsc.control |   13 +++++++++++++
 client/tests/kvm/tests_base.cfg.sample        |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/autotest_control/tsc.control
client/tests/kvm/autotest_control/tsc.control new file +13 -0
new file mode 100644
index 0000000..0c1c65a
@@ -0,0 +1,13 @@
+NAME = 'Check TSC'
+AUTHOR = 'Michael Davidson <[email protected]>'
+TIME = 'MEDIUM'
+TEST_CLASS = 'Kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+DOC = """
+checktsc is a user space program that checks TSC synchronization
+between pairs of CPUs on an SMP system using a technique borrowed
+from the Linux 2.6.18 kernel.
+"""
+
+job.run_test('tsc')
client/tests/kvm/tests_base.cfg.sample +3 -0
index 2af6a05..861759e 100644
@@ -136,6 +136,9 @@ variants:
             - monotonic_time:
                 test_name = monotonic_time
                 test_control_file = monotonic_time.control
+            - tsc:
+                test_name = tsc
+                test_control_file = tsc.control
 
     - linux_s3:     install setup unattended_install
         type = linux_s3
#2 lore raw

Re: [Autotest] [PATCH 2/4] KVM test: Add TSC into guest test

Quoted 2 lines · Jason Wang

TSC is used to check the whether the TSC of processors are synchronized which is useful for testing virtual TSC.

The only thing that needs to be corrected here is that this test needs -smp > 1 to work (actually, even numbers work better), so I'll make it not available with -smp 1. Thanks for the patch, I am going to put it upstream soon!

Quoted 46 lines

---
 client/tests/kvm/autotest_control/tsc.control |   13 +++++++++++++ client/tests/kvm/tests_base.cfg.sample        |    3 +++

 2 files changed, 16 insertions(+), 0 deletions(-)

 create mode 100644 client/tests/kvm/autotest_control/tsc.control

client/tests/kvm/autotest_control/tsc.control new file +13 -0
new file mode 100644
index 0000000..0c1c65a
@@ -0,0 +1,13 @@
+NAME = 'Check TSC'
+AUTHOR = 'Michael Davidson <[email protected]>'
+TIME = 'MEDIUM'
+TEST_CLASS = 'Kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+DOC = """
+checktsc is a user space program that checks TSC synchronization
+between pairs of CPUs on an SMP system using a technique borrowed
+from the Linux 2.6.18 kernel.
+"""
+
+job.run_test('tsc')
client/tests/kvm/tests_base.cfg.sample +0 -0
index 2af6a05..861759e 100644
@@ -136,6 +136,9 @@ variants:

            - monotonic_time:
                test_name = monotonic_time test_control_file = monotonic_time.control
+            - tsc:
+                test_name = tsc
+                test_control_file = tsc.control

    - linux_s3:     install setup unattended_install type = linux_s3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Signature · 1 line
Lucas
author
#3 lore raw

Re: [Autotest] [PATCH 2/4] KVM test: Add TSC into guest test

Quoted 12 lines · Lucas Meneghel Rodrigues
Quoted 3 lines · Jason Wang

TSC is used to check the whether the TSC of processors are synchronized which is useful for testing virtual TSC.

The only thing that needs to be corrected here is that this test needs -smp > 1 to work (actually, even numbers work better), so I'll make it not available with -smp 1. Thanks for the patch, I am going to put it upstream soon!

I agree, and maybe we'd better also use smp > 1 in the test of monotonic_time ?

Quoted 51 lines
Quoted 47 lines
---
 client/tests/kvm/autotest_control/tsc.control |   13 +++++++++++++
 client/tests/kvm/tests_base.cfg.sample        |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/autotest_control/tsc.control
client/tests/kvm/autotest_control/tsc.control new file +13 -0
new file mode 100644
index 0000000..0c1c65a
@@ -0,0 +1,13 @@
+NAME = 'Check TSC'
+AUTHOR = 'Michael Davidson <[email protected]>'
+TIME = 'MEDIUM'
+TEST_CLASS = 'Kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+DOC = """
+checktsc is a user space program that checks TSC synchronization
+between pairs of CPUs on an SMP system using a technique borrowed
+from the Linux 2.6.18 kernel.
+"""
+
+job.run_test('tsc')
client/tests/kvm/tests_base.cfg.sample +3 -0
index 2af6a05..861759e 100644
@@ -136,6 +136,9 @@ variants:
            - monotonic_time:
                test_name = monotonic_time
                test_control_file = monotonic_time.control
+            - tsc:
+                test_name = tsc
+                test_control_file = tsc.control
 
    - linux_s3:     install setup unattended_install
        type = linux_s3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

#4 lore raw

Re: [Autotest] [PATCH 2/4] KVM test: Add TSC into guest test

Quoted 7 lines · Jason Wang
Quoted 6 lines · Lucas Meneghel Rodrigues
Quoted 3 lines · Jason Wang

TSC is used to check the whether the TSC of processors are synchronized which is useful for testing virtual TSC.

Quoted 8 lines
Quoted 6 lines

The only thing that needs to be corrected here is that this test needs -smp > 1 to work (actually, even numbers work better), so I'll make it not available with -smp 1. Thanks for the patch, I am going to put it upstream soon!

I agree, and maybe we'd better also use smp > 1 in the test of monotonic_time ?

Monotonic time has not this restriction, as far as I know... Unless I am very mistaken

Quoted 57 lines
Quoted 41 lines
Quoted 41 lines

---
 client/tests/kvm/autotest_control/tsc.control |   13 +++++++++++++ client/tests/kvm/tests_base.cfg.sample        |    3 +++

 2 files changed, 16 insertions(+), 0 deletions(-)

 create mode 100644 client/tests/kvm/autotest_control/tsc.control

client/tests/kvm/autotest_control/tsc.control new file +13 -0
new file mode 100644
index 0000000..0c1c65a
@@ -0,0 +1,13 @@
+NAME = 'Check TSC'
+AUTHOR = 'Michael Davidson <[email protected]>'
+TIME = 'MEDIUM'
+TEST_CLASS = 'Kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+DOC = """
+checktsc is a user space program that checks TSC synchronization
+between pairs of CPUs on an SMP system using a technique borrowed
+from the Linux 2.6.18 kernel.
+"""
+
+job.run_test('tsc')
client/tests/kvm/tests_base.cfg.sample +0 -0
index 2af6a05..861759e 100644
@@ -136,6 +136,9 @@ variants:

            - monotonic_time:
                test_name = monotonic_time test_control_file = monotonic_time.control
+            - tsc:
+                test_name = tsc
+                test_control_file = tsc.control

    - linux_s3:     install setup unattended_install type = linux_s3

Quoted 10 lines
Quoted 6 lines

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Signature · 1 line
Lucas
author
#5 lore raw

Re: [Autotest] [PATCH 2/4] KVM test: Add TSC into guest test

Quoted 18 lines · Lucas Meneghel Rodrigues
Quoted 16 lines · Jason Wang
Quoted 14 lines · Lucas Meneghel Rodrigues
Quoted 4 lines · Jason Wang

TSC is used to check the whether the TSC of processors are synchronized which is useful for testing virtual TSC.

The only thing that needs to be corrected here is that this test needs -smp > 1 to work (actually, even numbers work better), so I'll make it not available with -smp 1. Thanks for the patch, I am going to put it upstream soon!

Quoted 8 lines
Quoted 3 lines

I agree, and maybe we'd better also use smp > 1 in the test of monotonic_time ?

Monotonic time has not this restriction, as far as I know... Unless I am very mistaken

Yes, it does not have such restriction, but I think it would be more reasonable to do the test in smp > 2 especially for kvmclock as it depends on per-vcpu data structure and guest tsc which may have more problems during the vcpu migration between physical processors.

Quoted 61 lines
Quoted 57 lines
Quoted 41 lines
Quoted 41 lines
---
 client/tests/kvm/autotest_control/tsc.control |   13 +++++++++++++
 client/tests/kvm/tests_base.cfg.sample        |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/autotest_control/tsc.control
client/tests/kvm/autotest_control/tsc.control new file +13 -0
new file mode 100644
index 0000000..0c1c65a
@@ -0,0 +1,13 @@
+NAME = 'Check TSC'
+AUTHOR = 'Michael Davidson <[email protected]>'
+TIME = 'MEDIUM'
+TEST_CLASS = 'Kernel'
+TEST_CATEGORY = 'Functional'
+TEST_TYPE = 'client'
+DOC = """
+checktsc is a user space program that checks TSC synchronization
+between pairs of CPUs on an SMP system using a technique borrowed
+from the Linux 2.6.18 kernel.
+"""
+
+job.run_test('tsc')
client/tests/kvm/tests_base.cfg.sample +3 -0
index 2af6a05..861759e 100644
@@ -136,6 +136,9 @@ variants:
            - monotonic_time:
                test_name = monotonic_time
                test_control_file = monotonic_time.control
+            - tsc:
+                test_name = tsc
+                test_control_file = tsc.control
 
    - linux_s3:     install setup unattended_install
        type = linux_s3
Quoted 10 lines
Quoted 7 lines

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

author
#6 lore raw

PATCH 3/4 KVM test: Add scrashme into guest test

In reply to Jason Wang

This patch let the scrashme run in the guest. Scrashme is one kind of fuzzing or stress test through systemcall. It should be useful in testing the VMM.

---
 client/tests/kvm/autotest_control/scrashme.control |   14 ++++++++++++++
 client/tests/kvm/tests_base.cfg.sample             |    3 +++
 2 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/autotest_control/scrashme.control
client/tests/kvm/autotest_control/scrashme.control new file +14 -0
new file mode 100644
index 0000000..ba2466f
@@ -0,0 +1,14 @@
+NAME='scrashme'
+AUTHOR='Yi Yang <[email protected]>'
+TEST_CATEGORY='Stress'
+TEST_CLASS='Kernel'
+TEST_TYPE='client'
+TIME='MEDIUM'
+DOC='''
+Runs the scrashme suite located at: 
+http://www.codemonkey.org.uk/projects/scrashme/
+
+Runs the scrashme syscalls test suite. This test mode will exercise
+kernel syscalls randomically, or in a sequential fashion.
+'''
+job.run_test('scrashme')
client/tests/kvm/tests_base.cfg.sample +3 -0
index 861759e..8cc83a9 100644
@@ -139,6 +139,9 @@ variants:
             - tsc:
                 test_name = tsc
                 test_control_file = tsc.control
+            - scrashme:
+                test_name = scrashme
+                test_control_file = scrashme.control
 
     - linux_s3:     install setup unattended_install
         type = linux_s3
#7 lore raw

Re: [PATCH 3/4] KVM test: Add scrashme into guest test

This test was applied, but I changed the argument list to execute the test with --mode=random, that is, random syscalls will be tested with random values.

Quoted 51 lines · Jason Wang

This patch let the scrashme run in the guest. Scrashme is one kind of fuzzing or stress test through systemcall. It should be useful in testing the VMM.

---
 client/tests/kvm/autotest_control/scrashme.control |   14 ++++++++++++++ client/tests/kvm/tests_base.cfg.sample             |    3 +++

 2 files changed, 17 insertions(+), 0 deletions(-)

 create mode 100644 client/tests/kvm/autotest_control/scrashme.control

client/tests/kvm/autotest_control/scrashme.control new file +14 -0
new file mode 100644
index 0000000..ba2466f
@@ -0,0 +1,14 @@
+NAME='scrashme'
+AUTHOR='Yi Yang <[email protected]>'
+TEST_CATEGORY='Stress'
+TEST_CLASS='Kernel'
+TEST_TYPE='client'
+TIME='MEDIUM'
+DOC='''
+Runs the scrashme suite located at:
+http://www.codemonkey.org.uk/projects/scrashme/
+
+Runs the scrashme syscalls test suite. This test mode will exercise
+kernel syscalls randomically, or in a sequential fashion.
+'''
+job.run_test('scrashme')
client/tests/kvm/tests_base.cfg.sample +0 -0
index 861759e..8cc83a9 100644
@@ -139,6 +139,9 @@ variants:

            - tsc:
                test_name = tsc test_control_file = tsc.control
+            - scrashme:
+                test_name = scrashme
+                test_control_file = scrashme.control

    - linux_s3:     install setup unattended_install type = linux_s3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Signature · 1 line
Lucas
author
#8 lore raw

PATCH 4/4 KVM test: Enable timedrift for Linux guests

In reply to Jason Wang

We should also test timedrift for Linux guests especially for guest with pvclock. So this patch enable the timedrift for linux guests.

---
 client/tests/kvm/tests_base.cfg.sample |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
client/tests/kvm/tests_base.cfg.sample +10 -1
index 8cc83a9..dcd0dcf 100644
@@ -330,7 +330,7 @@ variants:
 variants:
     # Linux section
     - @Linux:
-        no timedrift autoit
+        no autoit
         shutdown_command = shutdown -h now
         reboot_command = shutdown -r now
         status_test_command = echo $?
@@ -342,6 +342,15 @@ variants:
         file_transfer_port = 22
         mem_chk_cmd = dmidecode -t 17 | awk -F: '/Size/ {print $2}'
         cpu_chk_cmd = grep -c processor /proc/cpuinfo
+        timedrift:
+            time_command = date +'TIME: %a %m/%d/%Y %H:%M:%S.%N'
+            time_filter_re = "(?:TIME: \w\w\w )(.{19})(?:\.\d\d)"
+            time_format = "%m/%d/%Y %H:%M:%S"
+            guest_load_command = "dd if=/dev/urandom of=/dev/null"
+            guest_load_instances = 2
+            guest_load_clean_cmd = "killall -9 dd"
+            host_load_command = "bzip2 -c --best /dev/urandom > /dev/null"
+            host_load_instances = 8
 
         variants:
             - Fedora: