Re: Solaris ASM problem - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Solaris ASM problem
Date
Msg-id 200604291158.k3TBwId09203@candle.pha.pa.us
Whole thread Raw
In response to Solaris ASM problem  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Theo Schlossnagle wrote:
> Kris Jurka wrote:
> 
> >
> >
> > On Fri, 28 Apr 2006, Theo Schlossnagle wrote:
> >
> >> Kris Jurka wrote:
> >>
> >>> Anyway the test exits with
> >>> Stuck spinlock (80618e9) detected at ./s_lock.c:355.
> >>>
> >>> on a linux gcc build this exits with
> >>> Stuck spinlock (0x5013ad) detected at ./s_lock.c:402.
> >>
> >>
> >> This seems like a different problem, no?  The patch I sent in didn't 
> >> touch any of the linux assembly bits.  The linux test should pass to 
> >> the end without an issue right?
> >>
> >
> > No, that's the desired ending.  It prints:
> >
> > S_LOCK_TEST: this will print 1000 stars and then
> >              exit with a 'stuck spinlock' message
> >              if S_LOCK() and TAS() are working.
> >
> > The solaris version is just getting stuck before at another point before
> > the expected stuck point.
> 
> I downloaded and tested this on my box.  The first thing I noticed is 
> that when compiling tas.s on Solaris 10 the -P flag was omitted (which 
> is needed to have the #ifdef's process correctly).  I did an: as -P 
> tas.s by hand and then was able to repeat your problem.

You should see in backend/port/Makfile:
       $(CC) $(CFLAGS) -c -P $<

Perhaps you didn't get that version yet.

> Looks like part of my patch wasn't applied (or I neglected to send it 
> all).  The cas operations are all word operations so the slock_t _MUST_ 
> be changed to a word.

Sorry, yes, that is my fault.  I had to modify the macro test you
defined from __amd64 to __x86_64__, and didn't see the change in the
typedef.  Fix applied.

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


> 
> In src/include/storage/s_lock.h in the sun section, the slock_t must be 
> an unsigned int:
> 
> ; cvs diff -u src/include/storage/s_lock.h
> Index: src/include/storage/s_lock.h
> ===================================================================
> RCS file: /projects/cvsroot/pgsql/src/include/storage/s_lock.h,v
> retrieving revision 1.151
> diff -u -r1.151 s_lock.h
> --- src/include/storage/s_lock.h        28 Apr 2006 03:43:19 -0000      
> 1.151
> +++ src/include/storage/s_lock.h        29 Apr 2006 02:48:45 -0000
> @@ -765,7 +765,7 @@
>  
>  #if defined(__sun) && (defined(__i386) || defined(__x86_64__) || 
> defined(__sparc__) || defined(__sparc))
>  #define HAS_TEST_AND_SET
> -typedef unsigned char slock_t;
> +typedef unsigned int slock_t;
>  
>  extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with,
>                                                                           
> slock_t cmp);
> 
> 

--  Bruce Momjian   http://candle.pha.pa.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Exports from postgres
Next
From: Thomas Hallgren
Date:
Subject: stdout when running as a Windows service