Re: Stuck Spinlock (fwd) - m68k architecture, 7.0.3 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Stuck Spinlock (fwd) - m68k architecture, 7.0.3
Date
Msg-id 16166.981386796@sss.pgh.pa.us
Whole thread Raw
In response to Stuck Spinlock (fwd) - m68k architecture, 7.0.3  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-hackers
"Oliver Elphick" <olly@lfix.co.uk> writes:
> Has anyone got PostgreSQL 7.0.3 working on m68k architecture?
> Russell is trying to install it on m68k and is consistently getting a
> stuck spinlock in initdb.   He used to have 6.3.2 working. Both 6.5.3
> and 7.0.3 fail.
> His message shows that the first attempt to set a lock fails.

There was no TAS() support for m68k before 6.5, so 6.3.2 could have
"worked" only for rather small values of "work".

Just eyeballing the m68k TAS assembly code, I think it is incorrectly
assuming that the result register will start off as zeroes.  Please try
the following patch in src/include/storage/s_lock.h:

  static __inline__ int
  tas(volatile slock_t *lock)
  {
      register int rv;

      __asm__    __volatile__(
+         "    clrl   %0        \n"
          "    tas    %1        \n"
          "    sne    %0        \n"
  :        "=d"(rv), "=m"(*lock)
  :        "1"(*lock)
  :        "cc");

      return rv;
  }

(This is against the current CVS file; the code is formatted differently
in 6.5, but is equivalent.)

Don't forget to "make clean" and rebuild the whole backend after
applying the patch, unless you've set up proper dependency tracking.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Mathieu Dube
Date:
Subject: 1024 limits??
Next
From: Mathieu Dube
Date:
Subject: Re: 1024 limits??