pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Martin Pitt <mpitt@debian.org>
Cc: pgsql-bugs@postgresql.org
Subject: Re: [PATCH v2] Use CC atomic builtins as a fallback
Date: Wed, 21 Dec 2011 10:55:16 -0500
Message-ID: <5642.1324482916@sss.pgh.pa.us> (raw)
In-Reply-To: <20111221080940.GB2743@piware.de>
References: <4EEB1C77.1000309@enterprisedb.com>
	<20111218224203.GA2950@piware.de>
	<CA+TgmoZzgNrWT3af50YL3_zfSN8AtNXK9sOeACti=5ukwiR0vg@mail.gmail.com>
	<20111219171145.GN2972@piware.de>
	<23930.1324433689@sss.pgh.pa.us>
	<20111221080940.GB2743@piware.de>

Martin Pitt <mpitt@debian.org> writes:
> Tom Lane [2011-12-20 21:14 -0500]:
>> Another thing that is bothering me is that according to the gcc
>> manual, eg here,
>> http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html
>> __sync_lock_test_and_set is nominally provided for datatypes 1, 2,
>> 4, or 8 bytes in length, but the underlying hardware doesn't
>> necessarily support all those widths natively.  If you pick the
>> wrong width then you don't get an inline operation at all, but a
>> call to some possibly inefficient library subroutine.

> It's even worse. Our original version of the patch used a char, and
> while that worked fine on the older Babbage board, it completely broke
> at runtime on e. g. a Panda board. It wasn't just slow, it caused
> hangs and test failures all over the place. With int it works
> flawlessly.

Yeah, that was another thing I found worrisome while googling: there
were a disturbingly large number of claims that __sync_lock_test_and_set
and/or __sync_lock_release were flat-out broken on various combinations
of gcc version and platform.  After reading that, there is no way at all
that I'd accept your original patch to use these functions everywhere.

For the moment I'm inclined to consider using these functions *only* on
ARM, so as to limit our exposure to such bugs.  That would also limit
the risk of using an inappropriate choice of lock width.

			regards, tom lane



view thread (4+ messages)

Message-ID: <5642.1324482916@sss.pgh.pa.us>
Permalink:  ../5642.1324482916@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5642.1324482916@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mpitt@debian.org
  Subject: Re: [PATCH v2] Use CC atomic builtins as a fallback
  In-Reply-To: <5642.1324482916@sss.pgh.pa.us>
  References: <4EEB1C77.1000309@enterprisedb.com> <20111218224203.GA2950@piware.de> <CA+TgmoZzgNrWT3af50YL3_zfSN8AtNXK9sOeACti=5ukwiR0vg@mail.gmail.com> <20111219171145.GN2972@piware.de> <23930.1324433689@sss.pgh.pa.us> <20111221080940.GB2743@piware.de> <5642.1324482916@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox