Re: Alpha tas() patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Alpha tas() patch
Date: 2000-12-28 21:33:56
Message-ID: 6054.978039236@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Brent Verner <brent(at)rcfile(dot)org> writes:
> what have I stumbled into :). 'damnit Jim!, I'm just a perl hacker.'

I've found an online version of the AXP Architecture Handbook at
ftp://ftp.netbsd.org/pub/NetBSD/misc/dec-docs/index.html
in particular the file ec-qd2ka-te.ps.gz listed near the top of
the page. After perusing same, it seems that the tas() code presently
in CVS sources *is correct*, although not very transparently written
(for example, "or $31, 1, $0" would be more clearly expressed as
"mov 1, $0"). See sections 4.2.4, 4.2.5, 4.11.4, and 5.5, especially
the sample code for a software critical section in 5.5.3.

At this point my opinion is that there's nothing functionally wrong
with the existing Alpha assembly code in s_lock.h, and that the
CreateCheckPoint failure is due to CreateCheckPoint misusing the routine
(see my recent message to pghackers).

I believe that we should change s_lock.h to use the inline assembly code
when using gcc on Alpha, regardless of OS.

The more interesting question is what to do for non-gcc compilers.
The INTERLOCKED_TESTBITSS_QUAD macro is not really suitable, primarily
because it does not include an "mb" instruction. (It also violates the
architecture manual's recommendation to not do redundant stores into a
lock word, but that's not so critical.) Is there anything in
<alpha/builtins.h> that provides access to the memory-barrier
instruction?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Myers 2000-12-28 21:47:44 Re: Assuming that TAS() will succeed the first time is verboten
Previous Message Brent Verner 2000-12-28 21:10:56 Re: Alpha tas() patch

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2000-12-28 23:56:58 Re: Two minor fixes to reduce resource usage in JDBC drivers
Previous Message Brent Verner 2000-12-28 21:10:56 Re: Alpha tas() patch