Re: BUG #2401: spinlocks not available on amd64

From: Theo Schlossnagle <jesus(at)omniti(dot)com>
To: Gregory Stark <stark(at)mit(dot)edu>
Cc: Theo Schlossnagle <jesus(at)omniti(dot)com>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org, josh(dot)berkus(at)sun(dot)com, robert(dot)lor(at)sun(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: BUG #2401: spinlocks not available on amd64
Date: 2009-06-24 15:29:13
Message-ID: 66B892B7-3A73-4F8D-B5AD-7FE84E4FFE99@omniti.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

The amd64 spintlock instructions use no AMD-specific features. It's
base intel 64bit instruction set. We ship a product with similar such
spin locks and have never had an issue across a large variety of
chipsets (Intel, AMD, and virtualized).

In short, if you can actually run 64bit code, the CAS stuff should
just work.

On Jun 24, 2009, at 8:27 AM, Gregory Stark wrote:

>
> Theo Schlossnagle wrote:
>
>> Tom Lane wrote:
>>
>>> There is no reason for the i386 or AMD64 code to be different from
>>> what's
>>> already tested on Linux --- the hardware's the same and the OS
>>> surely
>>> doesn't make a difference at this level.
>>
>> On linux you use gcc, which allows for inline assembly. So, the
>> code is
>> already very different.
>
> How does this interact with binary builds such as rpms? If someone
> installs an
> amd64 binary on an x86 machine or vice versa does this assembly do
> the right
> thing at all? Does it perform slowly?
>
> Ideally we would compile both and pick the right one at run-time but
> that
> might have annoying overhead if there's a branch before every
> pg_atomic_cas
> call.
>
> Perhaps a minimal thing to do would be to detect a mismatch on
> startup and log
> a message about it.
>
> --
> Gregory Stark
> http://mit.edu/~gsstark/resume.pdf

--
Theo Schlossnagle
http://omniti.com/is/theo-schlossnagle
p: +1.443.325.1357 x201 f: +1.410.872.4911

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Joe Conway 2009-06-24 18:28:45 Re: BUG #4876: author of MD5 says it's seriously broken - hash collision resistance problems
Previous Message Gregory Stark 2009-06-24 15:27:02 Re: BUG #2401: spinlocks not available on amd64

Browse pgsql-patches by date

  From Date Subject
Next Message Alex Shulgin 2014-11-18 16:58:12 Re: Removing unreferenced files
Previous Message Gregory Stark 2009-06-24 15:27:02 Re: BUG #2401: spinlocks not available on amd64