All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	david@redhat.com, "Laurent Vivier" <lvivier@redhat.com>,
	kvm-ppc@vger.kernel.org
Subject: [kvm-unit-tests PATCH v1 3/3] x86: use asm-generic spinlock
Date: Fri, 12 May 2017 12:20:42 +0200	[thread overview]
Message-ID: <20170512102042.4956-4-david@redhat.com> (raw)
In-Reply-To: <20170512102042.4956-1-david@redhat.com>

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/x86/asm/spinlock.h |  9 ++-------
 lib/x86/smp.c          | 16 ----------------
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/lib/x86/asm/spinlock.h b/lib/x86/asm/spinlock.h
index 4b0cb33..e302b56 100644
--- a/lib/x86/asm/spinlock.h
+++ b/lib/x86/asm/spinlock.h
@@ -1,11 +1,6 @@
+#include <asm-generic/spinlock.h>
+
 #ifndef __ASM_SPINLOCK_H
 #define __ASM_SPINLOCK_H
 
-struct spinlock {
-    int v;
-};
-
-void spin_lock(struct spinlock *lock);
-void spin_unlock(struct spinlock *lock);
-
 #endif
diff --git a/lib/x86/smp.c b/lib/x86/smp.c
index 1eb49f2..4bdbeae 100644
--- a/lib/x86/smp.c
+++ b/lib/x86/smp.c
@@ -43,22 +43,6 @@ asm (
 #endif
      );
 
-void spin_lock(struct spinlock *lock)
-{
-    int v = 1;
-
-    do {
-	asm volatile ("xchg %1, %0" : "+m"(lock->v), "+r"(v));
-    } while (v);
-    asm volatile ("" : : : "memory");
-}
-
-void spin_unlock(struct spinlock *lock)
-{
-    asm volatile ("" : : : "memory");
-    lock->v = 0;
-}
-
 int cpu_count(void)
 {
     return _cpu_count;
-- 
2.9.3

WARNING: multiple messages have this Message-ID (diff)
From: David Hildenbrand <david@redhat.com>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	david@redhat.com, "Laurent Vivier" <lvivier@redhat.com>,
	kvm-ppc@vger.kernel.org
Subject: [kvm-unit-tests PATCH v1 3/3] x86: use asm-generic spinlock
Date: Fri, 12 May 2017 10:20:42 +0000	[thread overview]
Message-ID: <20170512102042.4956-4-david@redhat.com> (raw)
In-Reply-To: <20170512102042.4956-1-david@redhat.com>

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 lib/x86/asm/spinlock.h |  9 ++-------
 lib/x86/smp.c          | 16 ----------------
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/lib/x86/asm/spinlock.h b/lib/x86/asm/spinlock.h
index 4b0cb33..e302b56 100644
--- a/lib/x86/asm/spinlock.h
+++ b/lib/x86/asm/spinlock.h
@@ -1,11 +1,6 @@
+#include <asm-generic/spinlock.h>
+
 #ifndef __ASM_SPINLOCK_H
 #define __ASM_SPINLOCK_H
 
-struct spinlock {
-    int v;
-};
-
-void spin_lock(struct spinlock *lock);
-void spin_unlock(struct spinlock *lock);
-
 #endif
diff --git a/lib/x86/smp.c b/lib/x86/smp.c
index 1eb49f2..4bdbeae 100644
--- a/lib/x86/smp.c
+++ b/lib/x86/smp.c
@@ -43,22 +43,6 @@ asm (
 #endif
      );
 
-void spin_lock(struct spinlock *lock)
-{
-    int v = 1;
-
-    do {
-	asm volatile ("xchg %1, %0" : "+m"(lock->v), "+r"(v));
-    } while (v);
-    asm volatile ("" : : : "memory");
-}
-
-void spin_unlock(struct spinlock *lock)
-{
-    asm volatile ("" : : : "memory");
-    lock->v = 0;
-}
-
 int cpu_count(void)
 {
     return _cpu_count;
-- 
2.9.3


  parent reply	other threads:[~2017-05-12 10:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 10:20 [kvm-unit-tests PATCH v1 0/3] provide asm-generic spinlock David Hildenbrand
2017-05-12 10:20 ` David Hildenbrand
2017-05-12 10:20 ` [kvm-unit-tests PATCH v1 1/3] lib: provide generic spinlock David Hildenbrand
2017-05-12 10:20   ` David Hildenbrand
2017-05-12 10:58   ` Thomas Huth
2017-05-12 10:58     ` Thomas Huth
2017-05-12 16:43   ` Radim Krčmář
2017-05-12 16:43     ` Radim Krčmář
2017-05-12 16:49     ` Paolo Bonzini
2017-05-12 16:49       ` Paolo Bonzini
2017-05-15  7:48     ` David Hildenbrand
2017-05-15  7:48       ` David Hildenbrand
2017-05-12 10:20 ` [kvm-unit-tests PATCH v1 2/3] ppc64: use asm-generic spinlock David Hildenbrand
2017-05-12 10:20   ` David Hildenbrand
2017-05-12 10:55   ` Thomas Huth
2017-05-12 10:55     ` Thomas Huth
2017-05-12 10:20 ` David Hildenbrand [this message]
2017-05-12 10:20   ` [kvm-unit-tests PATCH v1 3/3] x86: " David Hildenbrand

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=20170512102042.4956-4-david@redhat.com \
    --to=david@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=thuth@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.