Re: better atomics - v0.6

From: Oskari Saarenmaa <os(at)ohmu(dot)fi>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Ants Aasma <ants(at)cybertec(dot)at>
Subject: Re: better atomics - v0.6
Date: 2014-09-23 21:27:25
Message-ID: 5421E5BD.3030407@ohmu.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

23.09.2014, 15:18, Andres Freund kirjoitti:
> On 2014-09-23 13:50:28 +0300, Oskari Saarenmaa wrote:
>> 23.09.2014, 00:01, Andres Freund kirjoitti:
>>> The patches:
>>> 0001: The actual atomics API
>>
>> I tried building PG on Solaris 10/Sparc using GCC 4.9.0 (buildfarm animal
>> dingo) with this patch but regression tests failed due to:
>
> Btw, if you could try sun studio it'd be great. I wrote the support for
> it blindly, and I'd be surprised if I got it right on the first try.

I just installed Solaris Studio 12.3 and tried compiling this:

"../../../../src/include/port/atomics/generic-sunpro.h", line 54: return
value type mismatch
"../../../../src/include/port/atomics/generic-sunpro.h", line 77: return
value type mismatch
"../../../../src/include/port/atomics/generic-sunpro.h", line 79:
#if-less #endif
"../../../../src/include/port/atomics/generic-sunpro.h", line 81:
#if-less #endif

atomic_add_64 and atomic_add_32 don't return anything (the
atomic_add_*_nv variants return the new value) and there were a few
extra #endifs. Regression tests pass after applying the attached patch
which defines PG_HAS_ATOMIC_ADD_FETCH_U32.

There doesn't seem to be a fallback for defining pg_atomic_fetch_add
based on pg_atomic_add_fetch so pg_atomic_add_fetch now gets implemented
using pg_atomic_compare_exchange.

Also, it's not possible to compile PG with FORCE_ATOMICS_BASED_SPINLOCKS
with these patches:

"../../../../src/include/storage/s_lock.h", line 868: #error: PostgreSQL
does not have native spinlock support on this platform....

atomics/generic.h would implement atomic flags using operations exposed
by atomics/generic-sunpro.h, but atomics/fallback.h is included before
it and it defines functions for flag operations which s_lock.h doesn't
want to use.

/ Oskari

Attachment Content-Type Size
0001-atomics-fix-atomic-add-for-sunpro-and-drop-invalid-e.patch text/x-patch 1.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-09-23 21:40:22 Re: proposal: rounding up time value less than its unit.
Previous Message Kevin Grittner 2014-09-23 21:22:58 Re: delta relations in AFTER triggers