Re: lock support for aarch64

From: Mark Salter <msalter(at)redhat(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: lock support for aarch64
Date: 2013-05-13 13:48:37
Message-ID: 1368452917.23422.21.camel@t520.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 spinlock support on this platform. To continue the compilation, rerun configure using --disable-spinlocks. However, performance will be poor. Please report this to pgsql-bugs(at)postgresql(dot)org(dot)

>
> 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-05-13 13:49:22 Re: corrupt pages detected by enabling checksums
Previous Message Jon Nelson 2013-05-13 13:45:41 Re: corrupt pages detected by enabling checksums