Subject: Re: Alpha assembly question...
To: Todd Vierling <tv@pobox.com>
From: Kevin P. Neal <kpneal@pobox.com>
List: port-alpha
Date: 02/17/2000 12:06:01
On Thu, Feb 17, 2000 at 09:18:59AM -0500, Todd Vierling wrote:
> On Wed, 16 Feb 2000, Allen Briggs wrote:
>
> : > Anyway, I made it this far in getting Postgres to run:
> : > [...]
> : > FATAL: s_lock(20318030) at spin.c:114, stuck spinlock. Aborting.
> :
> : That's as far as I got, too. I haven't gotten back to it. I
> : was suspecting LP64 bugs when I last looked at it. Does anyone
> : know if it really runs on Tru64/OSF or Linux/alpha?
>
> No, it does not. Search AltaVista for "+alpha +linux +postgresql"--it's
> littered with LP64 breakage.
Well, I got farther. Can someone explain this to me? I can't figure out
why it breaks like this. I found that if I make tas() not be __inline__
then I can get Postgres to work well enough to build it's own
databases and then finish installing. (I'll have a set of patches
ready hopefully tonight -- perhaps Postgres won't be perfect but it'll
be closer.)
(make post-install 2>&1 log ; tail log)
(locklock = 1, flag = 0, nshlocks = 0, shlock = 0, exlock =0)
S_LOCK in: lock 540131376 *lock 0 file spin.c 117
S_LOCK progress: lock 540131376 *lock 1 file spin.c 117
s_lock entry: lock 4835098672, *lock 1, spin.c, 117
^^^^^^^^^^ WRONG. Should be 540131376
Output generated starting with: (in void SpinAcquire(lockid))
PRINT_LOCK(slckP);
switch (slckP->flag)
{
case NOLOCK:
slckP->flag = EXCLUSIVELOCK;
S_LOCK(&(slckP->exlock));
Where S_LOCK is: (in include storage/s_lock.h)
extern void s_lock(volatile slock_t *lock, const char *file, const int line);
#define S_LOCK(lock) \
do { \
fprintf(stderr,"S_LOCK in: lock %d *lock %d file %s %d\n", lock,
*lock, __FILE__, __LINE__); \
if (TAS((volatile slock_t *) lock)) { fprintf(stderr,"S_LOCK pro
gress: lock %d *lock %d file %s %d\n", lock, *lock, __FILE__, __LINE__);\
s_lock((volatile slock_t *) lock, __FILE__, __LINE__);}
\
fprintf(stderr,"S_LOCK out: lock %d *lock %d file %s %d\n", lock
, *lock, __FILE__, __LINE__); \
} while (0)
Next s_lock has:
fprintf(stderr, "s_lock entry: lock %ld, *lock %d, %s, %d\n",
lock, *lock, file, line);
while (TAS(lock))
{
(snip)
Last, TAS is:
#define TAS(lock) tas(lock)
#define S_UNLOCK(lock) { fprintf(stderr, "unlock %d %s %d\n", lock, __FILE__, __
LINE__ ); __asm__("mb"); *(lock) = 0; }
/* static __inline__ int */
static __inline__ int
tas(volatile slock_t *lock)
{
register slock_t _res;
__asm__(" ldq $0, %0 \n\
bne $0, 3f \n\
ldq_l $0, %0 \n\
bne $0, 3f \n\
or $31, 1, $0 \n\
stq_c $0, %0 \n\
beq $0, 2f \n\
bis $31, $31, %1 \n\
mb \n\
jmp $31, 4f \n\
2: or $31, 1, $0 \n\
3: bis $0, $0, %1 \n\
4: nop ": "=m"(*lock), "=r"(_res): :"0");
return (int) _res;
}
--
XCOMM Kevin P. Neal: Senior, CSC, NCSU http://www.pobox.com/~kpn/
XCOMM
XCOMM "There are %d threatening little dwarves in the room with you."
XCOMM -- BSD /usr/games/adventure source code.