Re: lock support for aarch64 - Mailing list pgsql-hackers

From Mark Salter
Subject Re: lock support for aarch64
Date
Msg-id 1368452917.23422.21.camel@t520.redhat.com
Whole thread Raw
In response to Re: lock support for aarch64  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
On Mon, 2013-05-13 at 16:15 +0300, Heikki Linnakangas wrote:
> On 13.05.2013 15:39, Mark Salter wrote:
> > I used the following patch to add lock support aarch64. It is just a
> > copy of the arm support based on gcc builtins. Postgresql built with
> > this patch passes the various tests.
> 
> I think this needs an "#ifdef HAVE_GCC_INT_ATOMICS", like the ARM codepath.

Yes. Would it be better to do something like:

+/*
+ * Use gcc builtins if available.
+ */
+#if !defined(HAS_TEST_AND_SET) && 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
+/* Blow up if we didn't have any way to do spinlocks */#ifndef HAS_TEST_AND_SET#error PostgreSQL does not have native
spinlocksupport on this platform.  To continue the compilation, rerun configure using --disable-spinlocks.  However,
performancewill be poor.  Please report this to pgsql-bugs@postgresql.org.
 


> 
> If we are to support aarch64, it would be good to have an aarch64 
> machine on the buildfarm. Could you arrange that? See 
> http://buildfarm.postgresql.org/
> 

Right now, all we have is a simulator. It takes about 24hrs to build and
test the Fedora RPM. Hardware will start to be available soon. But yes,
I think we could arrange to add to the buildfarm.

--Mark





pgsql-hackers by date:

Previous
From: Jon Nelson
Date:
Subject: Re: corrupt pages detected by enabling checksums
Next
From: Andres Freund
Date:
Subject: Re: corrupt pages detected by enabling checksums