Thread: Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

From
Jayashankar K B
Date:

Hi All,

 

I am trying to compile Postgres Source code for ARM cortex A8 architecture.

While compiling, I got an error message which read “selected processor does not support `swpb r4,r4,[r3]' “

One of the Postgres forums at the location “http://postgresql.1045698.n5.nabble.com/BUG-6331-Cross-compile-error-aborts-Works-if-disable-spinlock-is-used-td5068738.html

Mentioned that by using –disable-spinlocks, we can overcome the error at the cost of performance. I did the same and it compiled successfully.

But the INSTALL guide in Postgres source code mentioned that I should inform the Postgres community in case I am forced to use –disable spinlocks to let the code compile.

Hence this email. So please suggest me what I should do now.  What sort of performance penalty will be there if I use this option? What actually is the significance of this parameter?

Please guide me.

 

This is the configure command I used

./configure CC=/opt/toolchain/bin/armv7l-timesys-linux-gnueabi-gcc --target=armv7l-timesys-linux-gnueabi --prefix=/home/jayashankar/WorkingDirectory/Postgres9.1_Cortex --host=x86_64-unknown-linux-gnu CFLAGS='-march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -mthumb' --disable-spinlocks

 

Thanks and Regards

Jayashankar

 



Larsen & Toubro Limited

www.larsentoubro.com

This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
Jayashankar K B <Jayashankar.KB@lnties.com> writes:
> Hi All,
> I am trying to compile Postgres Source code for ARM cortex A8 architecture.
> While compiling, I got an error message which read "selected processor does not support `swpb r4,r4,[r3]' "
> One of the Postgres forums at the location
"http://postgresql.1045698.n5.nabble.com/BUG-6331-Cross-compile-error-aborts-Works-if-disable-spinlock-is-used-td5068738.html"
> Mentioned that by using -disable-spinlocks, we can overcome the error at the cost of performance. I did the same and
itcompiled successfully. 
> But the INSTALL guide in Postgres source code mentioned that I should inform the Postgres community in case I am
forcedto use -disable spinlocks to let the code compile. 
> Hence this email. So please suggest me what I should do now.

Try this patch:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=068e08eebbb2204f525647daad3fe15063b77820

BTW, please don't cross-post to multiple PG mailing lists; there's very
seldom a good reason to do that.

            regards, tom lane

Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

From
Jayashankar K B
Date:
Hi Tom,

Sorry about the cross-post.
I am not aware of the procedures for patch etc.
Could you please tell me how to use the patch ?
I have already compiled and got the postgres server.
So please let me know the process of patching or kindly point me to a link which explain this.

Thanks and Regards
Jayashankar

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 24 February 2012 AM 09:20
To: Jayashankar K B
Cc: pgsql-general@postgresql.org; pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

Jayashankar K B <Jayashankar.KB@lnties.com> writes:
> Hi All,
> I am trying to compile Postgres Source code for ARM cortex A8 architecture.
> While compiling, I got an error message which read "selected processor does not support `swpb r4,r4,[r3]' "
> One of the Postgres forums at the location
"http://postgresql.1045698.n5.nabble.com/BUG-6331-Cross-compile-error-aborts-Works-if-disable-spinlock-is-used-td5068738.html"
> Mentioned that by using -disable-spinlocks, we can overcome the error at the cost of performance. I did the same and
itcompiled successfully. 
> But the INSTALL guide in Postgres source code mentioned that I should inform the Postgres community in case I am
forcedto use -disable spinlocks to let the code compile. 
> Hence this email. So please suggest me what I should do now.

Try this patch:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=068e08eebbb2204f525647daad3fe15063b77820

BTW, please don't cross-post to multiple PG mailing lists; there's very seldom a good reason to do that.

                        regards, tom lane


Larsen & Toubro Limited

www.larsentoubro.com

This Email may contain confidential or privileged information for the intended recipient (s) If you are not the
intendedrecipient, please do not use or disseminate the information, notify the sender and delete it from your system. 

Re: Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

From
Merlin Moncure
Date:
On Thu, Feb 23, 2012 at 3:09 PM, Jayashankar K B
<Jayashankar.KB@lnties.com> wrote:
> Hi Tom,
>
> Sorry about the cross-post.
> I am not aware of the procedures for patch etc.
> Could you please tell me how to use the patch ?

see general instructions here:
http://jungels.net/articles/diff-patch-ten-minutes.html

merlin

Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

From
Jayashankar K B
Date:
Hi Tom,
 
I tried to apply the patch. I succeeded in patching configure, configure.in and src/include/pg_config.h.in files.
But while applying the patch for src/include/storage/s_lock.h , I am getting an error.
 
This is how I am doing the patch,
  1. I copied the diff output given in the link mentioned in the below email.
  2. Changed the file names appropriately (patch file path is different from source file path. But I have initialized --- and +++ appropriately
  3. Executed the patch command in the Postgres 9.1.1 directory as “patch src/include/storage/s_lock.h -i s_lock.h_Patch
  4. Got the following output
Hunk #1 succeeded at 252 with fuzz 1.
Hunk #2 FAILED at 292.
1 out of 2 hunks FAILED -- saving rejects to file src/include/storage/s_lock.h.rej
 
Thought of doing the failed patch manually. But couldn’t understand what to do.
 
Please let me know what I am doing wrong and what I should be doing.
 
Thanks and Regards
Jayashankar
 
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 24 February 2012 AM 09:20
To: Jayashankar K B
Cc: pgsql-general@postgresql.org; pgsql-performance@postgresql.org
Subject: Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8
 
Jayashankar K B <Jayashankar.KB@lnties.com> writes:
> Hi All,
> I am trying to compile Postgres Source code for ARM cortex A8 architecture.
> While compiling, I got an error message which read "selected processor does not support `swpb r4,r4,[r3]' "
> Mentioned that by using -disable-spinlocks, we can overcome the error at the cost of performance. I did the same and it compiled successfully.
> But the INSTALL guide in Postgres source code mentioned that I should inform the Postgres community in case I am forced to use -disable spinlocks to let the code compile.
> Hence this email. So please suggest me what I should do now.
 
Try this patch:
 
BTW, please don't cross-post to multiple PG mailing lists; there's very seldom a good reason to do that.
 
                        regards, tom lane
 


Larsen & Toubro Limited

www.larsentoubro.com

This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
Jayashankar K B <Jayashankar.KB@lnties.com> writes:
> I tried to apply the patch. I succeeded in patching configure, configure.in and src/include/pg_config.h.in files.
> But while applying the patch for src/include/storage/s_lock.h , I am getting an error.

That patch should apply exactly to 9.1.0 or later.  I think either you
messed up copying the patch from the web page (note that patch is not
forgiving about white space...) or else perhaps fooling with the file
names messed it up.  You shouldn't have to modify the file taken from
the "patch" link at all.  The right way to do it is to cd into the
top source directory and use
    patch -p1 <patchfile
which will tell patch how much of the filename to pay attention to
(viz, not the "a/" or "b/" parts).

If you get too frustrated, just wait till Monday and grab 9.1.3.

            regards, tom lane

Re: Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

From
Jayashankar K B
Date:
Ok. I did a manual patch and it Postgres 9.1.1 compiled for me without using the --disable-spinlocks option.
Thanks a lot for the patch. :)
By the way, could you please point me to the explanation on the significance of spinlocks for Postgres?

Thanks and Regards
Jayashankar

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 25 February 2012 PM 12:54
To: Jayashankar K B
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

Jayashankar K B <Jayashankar.KB@lnties.com> writes:
> I tried to apply the patch. I succeeded in patching configure, configure.in and src/include/pg_config.h.in files.
> But while applying the patch for src/include/storage/s_lock.h , I am getting an error.

That patch should apply exactly to 9.1.0 or later.  I think either you messed up copying the patch from the web page
(notethat patch is not forgiving about white space...) or else perhaps fooling with the file names messed it up.  You
shouldn'thave to modify the file taken from the "patch" link at all.  The right way to do it is to cd into the top
sourcedirectory and use 
        patch -p1 <patchfile
which will tell patch how much of the filename to pay attention to (viz, not the "a/" or "b/" parts).

If you get too frustrated, just wait till Monday and grab 9.1.3.

                        regards, tom lane


Larsen & Toubro Limited

www.larsentoubro.com

This Email may contain confidential or privileged information for the intended recipient (s) If you are not the
intendedrecipient, please do not use or disseminate the information, notify the sender and delete it from your system. 

Re: Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

From
Merlin Moncure
Date:
On Sun, Feb 26, 2012 at 6:16 AM, Jayashankar K B
<Jayashankar.KB@lnties.com> wrote:
> Ok. I did a manual patch and it Postgres 9.1.1 compiled for me without using the --disable-spinlocks option.
> Thanks a lot for the patch. :)
> By the way, could you please point me to the explanation on the significance of spinlocks for Postgres?

spinlocks are used all over the place to synchronize access to shared
data structures (see here: http://en.wikipedia.org/wiki/Spinlock also
see here: http://rhaas.blogspot.com/2011/01/locking-in-postgresql.html).
 you can awkwardly implement them in high level languages like C but
typically there are hardware primitives that are much faster and
better to use.

very generally speaking, spinlocks are a better than semaphores when
the lock duration is very short, contention isn't terrible, and the
time taken to acquire the lock matters.

merlin