All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup
Date: Mon,  6 Jul 2015 15:31:24 +0200	[thread overview]
Message-ID: <1436189485-21443-2-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1436189485-21443-1-git-send-email-drjones@redhat.com>

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@redhat.com>
---
 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@redhat.com>
+ *
+ * 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


  reply	other threads:[~2015-07-06 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 13:31 [kvm-unit-tests PATCH 0/2] one fix, one resend Andrew Jones
2015-07-06 13:31 ` Andrew Jones [this message]
2015-07-06 17:51   ` [kvm-unit-tests PATCH 1/2] arm/arm64: spinlock-test fixup Paolo Bonzini
2015-07-07 11:24     ` Andrew Jones
2015-07-07 11:25       ` Paolo Bonzini
2015-07-06 13:31 ` [kvm-unit-tests PATCH 2/2] arm/arm64: allow building a single test Andrew Jones

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=1436189485-21443-2-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@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.