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 <msal...@redhat.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




-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to