[PATCH] Add support for TAS/S_UNLOCK for aarch64

From: Pavel Raiskup <praiskup(at)redhat(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Add support for TAS/S_UNLOCK for aarch64
Date: 2013-06-04 15:28:09
Message-ID: 1461525.0ujcQ0ct1n@praiskup.usersys.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, I was asked [1] to add following patch downstream, could it be
considered upstream also? Thanks, Pavel.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=970661

From ed791f40aa117d4fc273e4b96d9295ee9571fc96 Mon Sep 17 00:00:00 2001
From: Mark Salter <msalter(at)redhat(dot)com>
Date: Tue, 4 Jun 2013 17:23:01 +0200
Subject: [PATCH] Add support for TAS/S_UNLOCK for aarch64

---
src/include/storage/s_lock.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index ce45ffe..a2d6f63 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -336,6 +336,25 @@ tas(volatile slock_t *lock)
#endif /* __arm__ */


+/*
+ * Use gcc builtins for AArch64.
+ */
+#if defined(__aarch64__) && defined(HAVE_GCC_INT_ATOMICS)
+#define HAS_TEST_AND_SET
+
+#define TAS(lock) tas(lock)
+
+typedef int slock_t;
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+ return __sync_lock_test_and_set(lock, 1);
+}
+
+#define S_UNLOCK(lock) __sync_lock_release(lock)
+#endif /* __aarch64__ */
+
/* S/390 and S/390x Linux (32- and 64-bit zSeries) */
#if defined(__s390__) || defined(__s390x__)
#define HAS_TEST_AND_SET
--
1.8.2.1

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Charles 2013-06-04 15:31:17 Configurable location for extension .control files
Previous Message Simon Riggs 2013-06-04 13:45:17 Re: Optimising Foreign Key checks