Pierre Girard wrote:
> Bruce Momjian wrote:
>
> >>MAKE=gmake CC=/opt/SUNWspro/bin/cc CFLAGS="-xO3 -mt -fsimple=1
> >>-ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt
> >>-xtarget=opteron -xarch=amd64 -xregs=no%frameptr"
> >>CXX=/opt/SUNWspro/bin/CC CXXFLAGS="-xO3 -mt -fsimple=1 -ftrap=%none
> >>-nofstore -xbuiltin=%all -xlibmil -xlibmopt -xtarget=opteron
> >>-xarch=amd64 -xregs=no%frameptr" LDFLAGS="-xtarget=opteron -xarch=amd64"
> >>./configure --without-readline
> >>
> >>
> >
> >Wow, those are a lot of options. Are they all required? Are the
> >x64-specific?
> >
> >
> They're definitely not all required, the ones needed to activate amd
> specific code compilation are: -xtarget=opteron -xarch=amd64
>
> The other options were taken from a document from sun about optimizing
> mysql on amd64 found at this address:
> http://developers.sun.com/solaris/articles/mysql_perf_tune.html
> I don't know if they would work on a different processor or not.
>
> Hopefully they'll make another document with postgresql in mind.
Thanks. I have added the URL.
---------------------------------------------------------------------------
>
> >>>I am thinking the port isn't 100% fool-proof yet, but it is _much_
> >>>closer than it was, and people can now do testing to improve it.
> >>>
> >>>---------------------------------------------------------------------------
> >>>
> >>>Pierre Girard wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Bruce Momjian wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Interesting. Seems you have a setup that uses its own assembly source
> >>>>>file in port/tas/solaris_i386.s, rather than using inline C ASM. There
> >>>>>are files for both Sparc and i386 there, and are both used only for the
> >>>>>Sun compiler. Does the Sun compiler not support ASM inlining?
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>I don't know but i imagine that if the postgresql team decided to do it
> >>>>that way it's probably not supported.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>I also modified the function alignment from 4 to 8, patch
> >>>>>attached. Please give it a try and report back any error lines.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>I applied the patch and now the solaris_i386.s file compiles fine with
> >>>>the command:
> >>>>cc -Xa -xtarget=opteron -xarch=amd64 -c solaris_i386.s
> >>>>
> >>>>I made a few changes and was able to compile postgresql completely but i
> >>>>don't think we'll be trying it until after the holidays. I included
> >>>>the small changes i made but i'm sure you can make a much better job
> >>>>than i did.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Seems Sun might be interested in geting this working. We don't have an
> >>>>>official Sun contact yet for this project.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>Given this announcement, i'm surprised that you don't have a contact
> >>>>already:
> >>>>http://www.sun.com/smi/Press/sunflash/2005-11/sunflash.20051117.1.html
> >>>>
> >>>>Happy holidays everyone.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>>>diff -Naur postgresql-8.1.1/src/Makefile.shlib postgresql-8.1.1.new/src/Makefile.shlib
> >>>>--- postgresql-8.1.1/src/Makefile.shlib Sat Dec 3 15:16:39 2005
> >>>>+++ postgresql-8.1.1.new/src/Makefile.shlib Fri Dec 23 10:04:58 2005
> >>>>@@ -193,7 +193,7 @@
> >>>> ifeq ($(GCC), yes)
> >>>> LINK.shared = $(CC) -shared
> >>>> else
> >>>>- LINK.shared = $(CC) -G
> >>>>+ LINK.shared = $(CC) -G $(CFLAGS)
> >>>> endif
> >>>> ifeq ($(with_gnu_ld), yes)
> >>>> LINK.shared += -Wl,-soname,$(soname)
> >>>>diff -Naur postgresql-8.1.1/src/backend/port/tas/solaris_x86_64.s
postgresql-8.1.1.new/src/backend/port/tas/solaris_x86_64.s
> >>>>--- postgresql-8.1.1/src/backend/port/tas/solaris_x86_64.s Wed Dec 31 19:00:00 1969
> >>>>+++ postgresql-8.1.1.new/src/backend/port/tas/solaris_x86_64.s Fri Dec 23 09:17:13 2005
> >>>>@@ -0,0 +1,33 @@
> >>>>+/=============================================================================
> >>>>+/ tas.s -- test and set lock for solaris_i386
> >>>>+/=============================================================================
> >>>>+
> >>>>+ .file "tas.s"
> >>>>+ .text
> >>>>+ .align 16
> >>>>+.L1.text:
> >>>>+
> >>>>+ .globl tas
> >>>>+tas:
> >>>>+ pushq %rbp /save prev base pointer
> >>>>+ movq %rsp,%rbp /new base pointer
> >>>>+ pushq %rbx /save prev bx
> >>>>+ movq 8(%rbp),%rbx /load bx with address of lock
> >>>>+ movq $255,%rax /put something in ax
> >>>>+ xchgb %al,(%rbx) /swap lock value with "0"
> >>>>+ cmpb $0,%al /did we get the lock?
> >>>>+ jne .Locked
> >>>>+ subq %rax,%rax /yes, we got it -- return 0
> >>>>+ jmp .Finish
> >>>>+ .align 8
> >>>>+.Locked:
> >>>>+ movq $1,%rax /no, we didn't get it - return 1
> >>>>+.Finish:
> >>>>+ popq %rbx /restore prev bx
> >>>>+ movq %rbp,%rsp /restore stack state
> >>>>+ popq %rbp
> >>>>+ ret /return
> >>>>+ .align 8
> >>>>+ .type tas,@function
> >>>>+ .size tas,.-tas
> >>>>+
> >>>>diff -Naur postgresql-8.1.1/src/include/storage/s_lock.h postgresql-8.1.1.new/src/include/storage/s_lock.h
> >>>>--- postgresql-8.1.1/src/include/storage/s_lock.h Tue Oct 11 16:41:32 2005
> >>>>+++ postgresql-8.1.1.new/src/include/storage/s_lock.h Fri Dec 23 09:18:44 2005
> >>>>@@ -788,7 +788,7 @@
> >>>>
> >>>>/* out-of-line assembler from src/backend/port/tas/foo.s */
> >>>>
> >>>>-#if defined(__sun) && defined(__i386)
> >>>>+#if defined(__sun) && (defined(__i386) || defined(__x86_64__))
> >>>>/*
> >>>> * Solaris/386 (we only get here for non-gcc case)
> >>>> */
> >>>>diff -Naur postgresql-8.1.1/src/template/solaris postgresql-8.1.1.new/src/template/solaris
> >>>>--- postgresql-8.1.1/src/template/solaris Fri Jul 29 13:00:29 2005
> >>>>+++ postgresql-8.1.1.new/src/template/solaris Fri Dec 23 09:43:08 2005
> >>>>@@ -17,8 +17,15 @@
> >>>> ;;
> >>>> i?86-*-solaris*)
> >>>> if test "$GCC" != yes ; then
> >>>>- need_tas=yes
> >>>>- tas_file=solaris_i386.s
> >>>>+ soarch=`isainfo`
> >>>>+ if isainfo | grep amd64
> >>>>+ then
> >>>>+ need_tas=yes
> >>>>+ tas_file=solaris_x86_64.s
> >>>>+ else
> >>>>+ need_tas=yes
> >>>>+ tas_file=solaris_i386.s
> >>>>+ fi
> >>>> fi
> >>>> ;;
> >>>>esac
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073