pgsql: Modify Solaris compiler build rules to use the cpp preprocessor,

Started by Nonameover 19 years ago12 messages
#1Noname
momjian@postgresql.org

Log Message:
-----------
Modify Solaris compiler build rules to use the cpp preprocessor, the the
x86 file.

Modified Files:
--------------
pgsql/src/backend/port:
Makefile (r1.22 -> r1.23)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/port/Makefile.diff?r1=1.22&r2=1.23)

#2Kris Jurka
books@ejurka.com
In reply to: Noname (#1)
Re: pgsql: Modify Solaris compiler build rules to use the cpp preprocessor,

Bruce Momjian wrote:

Log Message:
-----------
Modify Solaris compiler build rules to use the cpp preprocessor, the the
x86 file.

Well it compiles now, but it doesn't seem to work:

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=kudu&dt=2006-04-28%2016:30:01

selecting default max_connections ... Abort - core dumped

creating template1 database in
/export/home/pgfarm/forte/HEAD/pgsql.5120/src/test/regress/./tmp_check/data/base/1
... PANIC: stuck spinlock (dd0000b0) detected at lwlock.c:358

#3Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Kris Jurka (#2)
Solaris ASM problem

Kris Jurka wrote:

Bruce Momjian wrote:

Log Message:
-----------
Modify Solaris compiler build rules to use the cpp preprocessor, the the
x86 file.

Well it compiles now, but it doesn't seem to work:

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=kudu&dt=2006-04-28%2016:30:01

selecting default max_connections ... Abort - core dumped

creating template1 database in
/export/home/pgfarm/forte/HEAD/pgsql.5120/src/test/regress/./tmp_check/data/base/1
... PANIC: stuck spinlock (dd0000b0) detected at lwlock.c:358

OK, now that I have modified the build system to properly handle the
preprocessing, it seems we have a problem with the ASM instructions.

Theo? Comments?

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#4Theo Schlossnagle
jesus@omniti.com
In reply to: Bruce Momjian (#3)
Re: Solaris ASM problem

Bruce Momjian wrote:

Kris Jurka wrote:

Bruce Momjian wrote:

Log Message:
-----------
Modify Solaris compiler build rules to use the cpp preprocessor, the the
x86 file.

Well it compiles now, but it doesn't seem to work:

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=kudu&dt=2006-04-28%2016:30:01

selecting default max_connections ... Abort - core dumped

creating template1 database in
/export/home/pgfarm/forte/HEAD/pgsql.5120/src/test/regress/./tmp_check/data/base/1
... PANIC: stuck spinlock (dd0000b0) detected at lwlock.c:358

OK, now that I have modified the build system to properly handle the
preprocessing, it seems we have a problem with the ASM instructions.

Theo? Comments?

What platform is that? (OS rev, architecture and word size)? I tested
the changes I submitted on Solaris 10 amd64.

--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Ecelerity: Run with it. -- http://www.omniti.com/

#5Kris Jurka
books@ejurka.com
In reply to: Theo Schlossnagle (#4)
Re: Solaris ASM problem

On Fri, 28 Apr 2006, Theo Schlossnagle wrote:

What platform is that? (OS rev, architecture and word size)? I tested the
changes I submitted on Solaris 10 amd64.

$ uname -a
SunOS albert 5.9 Generic_112234-03 i86pc i386 i86pc
$ cc -V
cc: Sun WorkShop 6 update 2 C 5.3 Patch 111680-09 2003/05/18

Kris Jurka

#6Theo Schlossnagle
jesus@omniti.com
In reply to: Kris Jurka (#5)
Re: Solaris ASM problem

Kris Jurka wrote:

On Fri, 28 Apr 2006, Theo Schlossnagle wrote:

What platform is that? (OS rev, architecture and word size)? I
tested the changes I submitted on Solaris 10 amd64.

$ uname -a
SunOS albert 5.9 Generic_112234-03 i86pc i386 i86pc
$ cc -V
cc: Sun WorkShop 6 update 2 C 5.3 Patch 111680-09 2003/05/18

Kris Jurka

The file that uses the spinlocks:
/src/backend/storage/lmgr/s_lock.c

can be compiled standalone with -DS_LOCK_TEST

Can you compile that and run the test. I'd be happy to troubleshoot it
hands-on, but I don't have access to that box.

Best regards,
Theo

--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Ecelerity: Run with it. -- http://www.omniti.com/

#7Kris Jurka
books@ejurka.com
In reply to: Theo Schlossnagle (#6)
1 attachment(s)
Re: Solaris ASM problem

On Fri, 28 Apr 2006, Theo Schlossnagle wrote:

The file that uses the spinlocks:
/src/backend/storage/lmgr/s_lock.c

can be compiled standalone with -DS_LOCK_TEST

To get the test to compile I had to link in tas.o as the attached patch
shows. Unfortunately this doesn't work for platforms that don't have a
tas.o, bailing out with file not found. Perhaps it's not important to fix
this test, but I thought I'd mention it.

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.

Kris Jurka

Attachments:

slocktest.patchtext/plain; charset=US-ASCII; name=slocktest.patchDownload
? src/backend/storage/lmgr/s_lock_test
Index: src/backend/storage/lmgr/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/storage/lmgr/Makefile,v
retrieving revision 1.20
diff -c -r1.20 Makefile
*** src/backend/storage/lmgr/Makefile	7 Oct 2004 00:08:04 -0000	1.20
--- src/backend/storage/lmgr/Makefile	28 Apr 2006 21:13:52 -0000
***************
*** 21,26 ****
--- 21,27 ----
  
  s_lock_test: s_lock.c $(top_builddir)/src/port/libpgport.a
  	$(CC) $(CPPFLAGS) $(CFLAGS) -DS_LOCK_TEST=1 $(srcdir)/s_lock.c \
+ 		$(top_builddir)/src/backend/port/tas.o \
  		-L $(top_builddir)/src/port -lpgport -o s_lock_test
  
  check: s_lock_test
#8Theo Schlossnagle
jesus@omniti.com
In reply to: Kris Jurka (#7)
Re: Solaris ASM problem

Kris Jurka wrote:

On Fri, 28 Apr 2006, Theo Schlossnagle wrote:

The file that uses the spinlocks:
/src/backend/storage/lmgr/s_lock.c

can be compiled standalone with -DS_LOCK_TEST

To get the test to compile I had to link in tas.o as the attached
patch shows. Unfortunately this doesn't work for platforms that don't
have a tas.o, bailing out with file not found. Perhaps it's not
important to fix this test, but I thought I'd mention it.

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?

--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Ecelerity: Run with it. -- http://www.omniti.com/

#9Kris Jurka
books@ejurka.com
In reply to: Theo Schlossnagle (#8)
Re: Solaris ASM problem

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.

Kris Jurka

#10Theo Schlossnagle
jesus@omniti.com
In reply to: Kris Jurka (#9)
Re: Solaris ASM problem

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.

My workstation is running 32bit solaris.. I can build and debug it
here... I'll give that a spin (hehe).

--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Ecelerity: Run with it. -- http://www.omniti.com/

#11Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Kris Jurka (#7)
1 attachment(s)
Re: Solaris ASM problem

Kris Jurka wrote:

On Fri, 28 Apr 2006, Theo Schlossnagle wrote:

The file that uses the spinlocks:
/src/backend/storage/lmgr/s_lock.c

can be compiled standalone with -DS_LOCK_TEST

To get the test to compile I had to link in tas.o as the attached patch
shows. Unfortunately this doesn't work for platforms that don't have a
tas.o, bailing out with file not found. Perhaps it's not important to fix
this test, but I thought I'd mention it.

Fixed with the attached patch. Thanks.

--
Bruce Momjian http://candle.pha.pa.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachments:

/bjm/difftext/x-diffDownload
Index: src/backend/storage/lmgr/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/lmgr/Makefile,v
retrieving revision 1.20
diff -c -c -r1.20 Makefile
*** src/backend/storage/lmgr/Makefile	7 Oct 2004 00:08:04 -0000	1.20
--- src/backend/storage/lmgr/Makefile	28 Apr 2006 22:51:26 -0000
***************
*** 19,27 ****
  SUBSYS.o: $(OBJS)
  	$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
  
  s_lock_test: s_lock.c $(top_builddir)/src/port/libpgport.a
  	$(CC) $(CPPFLAGS) $(CFLAGS) -DS_LOCK_TEST=1 $(srcdir)/s_lock.c \
! 		-L $(top_builddir)/src/port -lpgport -o s_lock_test
  
  check: s_lock_test
  	./s_lock_test
--- 19,31 ----
  SUBSYS.o: $(OBJS)
  	$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
  
+ ifdef TAS
+ TASPATH = $(top_builddir)/src/backend/port/tas.o
+ endif
+ 
  s_lock_test: s_lock.c $(top_builddir)/src/port/libpgport.a
  	$(CC) $(CPPFLAGS) $(CFLAGS) -DS_LOCK_TEST=1 $(srcdir)/s_lock.c \
! 		$(TASPATH) -L $(top_builddir)/src/port -lpgport -o s_lock_test
  
  check: s_lock_test
  	./s_lock_test
#12Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Bruce Momjian (#11)
Re: Solaris ASM problem

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. +