Re: xlc atomics

From: Andres Freund <andres(at)anarazel(dot)de>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>, Ants Aasma <ants(at)cybertec(dot)at>
Subject: Re: xlc atomics
Date: 2016-04-25 18:52:04
Message-ID: 20160425185204.jrvlghn3jxulsb7i@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016-04-23 21:54:07 -0400, Noah Misch wrote:
> I missed a second synchronization bug in generic-xlc.h, but the pgbench test
> suite caught it promptly after commit 008608b.

Nice catch.

> The bug is that the pg_atomic_compare_exchange_*() specifications
> grant "full barrier semantics", but generic-xlc.h provided only the
> semantics of an acquire barrier.

I find the docs at
http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.2/com.ibm.xlcpp131.aix.doc/compiler_ref/bifs_sync_atomic.html
to be be awfully silent about that matter. I guess you just looked at
the assembler code? It's nice that one can figure out stuff like that
from an architecture manual, but it's sad that the docs for the
intrinsics is silent about that matter.

I do wonder if I shouldn't have left xlc fall by the wayside, and make
it use the fallback implementation. Given it's popularity (or rather
lack thereof) that'd probably have been a better choice. But that ship
has sailed.

Except that I didn't verify the rs6000_pre_atomic_barrier() and
__fetch_and_add() internals about emitted sync/isync, the patch looks
good. We've so far not referred to "sequential consistency", but given
it's rise in popularity, I don't think it hurts.

Stricly speaking generic-xlc.c shouldn't contain inline-asm, but given
xlc is only there for power...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-04-25 18:53:26 Re: [BUGS] Breakage with VACUUM ANALYSE + partitions
Previous Message Joshua D. Drake 2016-04-25 18:38:07 Re: Rename max_parallel_degree?