Thread: Port Bug Report: non-OSF Alpha spin lock code seems to be incorrect

Port Bug Report: non-OSF Alpha spin lock code seems to be incorrect

From
Unprivileged user
Date:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Christopher C. Chimelis
Your email address      : chris@classnet.med.miami.edu

Category                : runtime: back-end
Severity                : critical

Summary: non-OSF Alpha spin lock code seems to be incorrect

System Configuration
--------------------
  Operating System   : Linux 2.2.1 ELF glibc 2.1.1

  PostgreSQL version : 6.5beta1

  Compiler used      : egcs 1.1.2

Hardware:
---------
Linux alpha 2.2.1 #4 Sat Feb 13 03:24:10 CET 1999 alpha unknown
Alpha Multia/UDB 166MHz 128M RAM
Actually does the same thing on all Alphas running Linux from what I can tell

Versions of other tools:
------------------------
gmake 3.77

--------------------------------------------------------------------------

Problem Description:
--------------------
This problem occurs with PostgreSQL 6.4.x as well as the new beta snapshot.  It seems that on the initial 'initdb'
duringsetup/installation, initdb dies with: 
FATAL: s_lock(202e88c0) at spin.c:114, stuck spinlock. Aborting.

I tried altering the delay timing on the detection of stuck spin locks, but it didn't help.  So, I then delved into the
spinlock asm code contained in src/include/storage/s_lock.h. 

Now, my assembly is VERY rusty (I barely know anything at all), so I figured the best way to approach this was to
comparethe code contained within (basically it's under the #ifdef gcc and __alpha sections -- NOT the OSF stuff) to the
workingspin lock implementations within the 2.2.x Linux kernel series (include/asm-alpha/{system.h,spinlock.h} and
noticedQUITE a few differences in basic instructions.  Granted, they do use slightly different typed elements, but from
whatI can tell, the kernel's code is correct and pgsql's backend isn't. 

If possible, can you take a look at both and maybe we can work on a fix for this together?  I would be happy to send
youall files involved, but unfortunately cannot help to fix the asm involved (I'm trying to find someone competent on
thealphas now). 

--------------------------------------------------------------------------

Test Case:
----------
just run initdb on an Alpha running Linux and pgsql 6.4.x or 6.5beta1

--------------------------------------------------------------------------

Solution:
---------
The backend code for handling spin locks on non-OSF (ie. uses gcc) Alphas needs to be compared to the spin lock code in
the2.2.x kernel series and fixed (using the kernel code as a sample of working spin lock handling).  I will help test
whenit's fixed if needed. 

--------------------------------------------------------------------------