[kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I hadn't plan to post this for kvm-unit-tests, but Paolo picked it
up. That's fine, but now we should add its header. Also, Paolo
tweaked the original to "use atomics by default", but it actually
was using non-atomic by default. Switch to atomics, and rename
the parameter from 'bad' (which is a bit ambiguous) to 'non-atomic'.
And, let's give it its own place in unittests.cfg, but leave it
disabled for now.

Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 arm/spinlock-test.c | 16 ++++++++++++----
 arm/unittests.cfg   |  6 ++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/arm/spinlock-test.c b/arm/spinlock-test.c
index 1dcf2b144a134..1f91edf4116a4 100644
--- a/arm/spinlock-test.c
+++ b/arm/spinlock-test.c
@@ -1,3 +1,11 @@
+/*
+ * Port of the spinlock torture test from virtualopensystems
+ * tcg_baremetal_tests
+ *
+ * Copyright (C) 2015, Red Hat Inc, Andrew Jones <drjones@xxxxxxxxxx>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.
+ */
 #include <libcflat.h>
 #include <asm/smp.h>
 #include <asm/cpumask.h>
@@ -69,12 +77,12 @@ int main(int argc, char **argv)
 {
 	int cpu;
 
-	if (argc && strcmp(argv[0], "bad") != 0) {
-		lock_ops.lock = gcc_builtin_lock;
-		lock_ops.unlock = gcc_builtin_unlock;
-	} else {
+	if (argc && strcmp(argv[0], "non-atomic") != 0) {
 		lock_ops.lock = none_lock;
 		lock_ops.unlock = none_unlock;
+	} else {
+		lock_ops.lock = gcc_builtin_lock;
+		lock_ops.unlock = gcc_builtin_unlock;
 	}
 
 	for_each_present_cpu(cpu) {
diff --git a/arm/unittests.cfg b/arm/unittests.cfg
index ee655b2678a4e..9993d133bc394 100644
--- a/arm/unittests.cfg
+++ b/arm/unittests.cfg
@@ -35,3 +35,9 @@ file = selftest.flat
 smp = $(getconf _NPROCESSORS_CONF)
 extra_params = -append 'smp'
 groups = selftest
+
+# Test spinlocks
+#[smp::spinlocks]
+#file = spinlock-test.flat
+#smp = $(getconf _NPROCESSORS_CONF)
+#groups = smp
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux