Re: [BUGS] BUG #2401: spinlocks not available on amd64

From: Theo Schlossnagle <jesus(at)omniti(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, josh(dot)berkus(at)sun(dot)com, robert(dot)lor(at)sun(dot)com, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2401: spinlocks not available on amd64
Date: 2006-04-27 23:55:38
Message-ID: 445159FA.7070206@omniti.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Tom Lane wrote:

>Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>
>
>>Great, changes attached and applied. I removed the solaris_i386 and
>>solaris_x86_64.s files and made just one solaris_x86.s. I updated the
>>build system to use the new file, updated the macros, and added some
>>documentation on the approach. Thanks.
>>
>>
>
>BTW, on the replacement of ldstub with cas: according to what I find in
>google, cas does not exist on pre-V9 SPARCs. Are we sure no one uses
>sparc v8 chips anymore? Is there any actual advantage to making that
>change?
>
>
This is true, and can be addressed with #defines to pull in the old old
code. Just to note, you can't run Solaris 10 or any future version of
Solaris on sparcv8 either. Sparcv8plus is 3bit sparc code and it does
support the cas operation. The instruction cas that operates on a word
is more much efficient than the code that it replaced. I'm don't own or
have access to any sparc machines old enough to have that issue (even on
my guest accounts at my alma mater). If this is a concern, it seems
more than reasonable to #elif the case in for that architecture in the
sparc assembly file -- being open source, you'll no doubt alienate some
dude who thinks its cool to run Postgres on his Sparc ELC.

I'd remind everyone that the spinlock stuff is entirely optional at
build time. I think it be more elegant approach to discontinue spinlock
support on sparcv8 and older sparc architectures and just force them to
use heavier weight locking mechanisms. I "accidentally" did this on my
Sol10 amd64 box before I realized what the build system did.

I also think it immensely useful to replace all of the tas subsystem
with cas so that one could reliabily lock these atomics with the process
id of the locker. This would allow extremely good diagnostics in the
event that a backend process is abruptly teminated while holding a log
on that shm segment. If the process ID was in there, it would then be a
contition that is both diagnosable and recoverable.

I could likely provide the cas bits and pieces to do this stuff on
linux/freebsd/mac os x and windows on x86/64 sparcv8plus/sparcv9 and PPC
if you think that would be useful.

Best regards,

Theo

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-04-28 03:43:28 Re: [BUGS] BUG #2401: spinlocks not available on amd64
Previous Message Tom Lane 2006-04-27 23:02:06 Re: [BUGS] BUG #2401: spinlocks not available on amd64

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-04-28 00:34:22 Re: Cleaning up multiply-defined-symbol warnings on OS X
Previous Message Tom Lane 2006-04-27 23:02:06 Re: [BUGS] BUG #2401: spinlocks not available on amd64