Re: Improving spin-lock implementation on ARM.

From: Krunal Bauskar <krunalbauskar(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improving spin-lock implementation on ARM.
Date: 2020-12-01 10:02:38
Message-ID: CAB10pyYNpdxuHjkxp_N4TdzeYC_qWSP0fn-0s1cCidvm_RBQLg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 1 Dec 2020 at 15:16, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
wrote:

> On Tue, Dec 1, 2020 at 6:26 AM Krunal Bauskar <krunalbauskar(at)gmail(dot)com>
> wrote:
> > On Tue, 1 Dec 2020 at 02:31, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
> wrote:
> >> BTW, how do you get that required gcc version is 9.4? I've managed to
> >> use LSE with gcc 9.3.
> >
> > Did they backported it to 9.3?
> > I am just looking at the gcc guide.
> > https://gcc.gnu.org/gcc-9/changes.html
> >
> > GCC 9.4
> >
> > Target Specific Changes
> >
> > AArch64
> >
> > The option -moutline-atomics has been added to aid deployment of the
> Large System Extensions (LSE)
>
> No, you've misread this release notes item. This item relates to a
> new option for LSE support. See the rest of the description.
>

Some confusion here.

What I meant was outline-atomics support was added in GCC-9.4 and was made
default in gcc-10.
LSE support is present for quite some time.

In one of my up-thread reply I mentioned about the outline atomic that
would help us enable lse if underline architecture support it.

<snippet from reply>
2. As you pointed out LSE is enabled starting only with arm-v8.1 but not
all aarch64 tag machines are arm-v8.1 compatible.
This means we would need a separate package or a more optimal way would
be to compile pgsql with gcc-9.4 (or gcc-10.x (default)) with
-moutline-atomics that would emit both traditional and lse code and
flow would dynamically select depending on the target machine
(I have blogged about it in MySQL context
https://mysqlonarm.github.io/ARM-LSE-and-MySQL/)
</snippet from reply>

Problem with this approach is it would need gcc-9.4+ (I also ready
gcc-9.3.1 would do) or gcc10.x but most of the distro doesn't support it so
user using old compiler especially
default one shipped with OS would not be able to take advantage of this.

>
> "When the option is specified code is emitted to detect the presence
> of LSE instructions at runtime and use them for standard atomic
> operations. For more information please refer to the documentation."
>
> LSE support itself was introduced in gcc 6.
> https://gcc.gnu.org/gcc-6/changes.html
> * The ARMv8.1-A architecture and the Large System Extensions are now
> supported. They can be used by specifying the -march=armv8.1-a option.
> Additionally, the +lse option extension can be used in a similar
> fashion to other option extensions. The Large System Extensions
> introduce new instructions that are used in the implementation of
> atomic operations.
>
> But, -moutline-atomics looks very interesting itself. I think we
> should add this option to our arm64 packages if we haven't already.
>
> ------
> Regards,
> Alexander Korotkov
>

--
Regards,
Krunal Bauskar

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anastasia Lubennikova 2020-12-01 10:05:54 Commitfest 2020-11 is closed
Previous Message Heikki Linnakangas 2020-12-01 09:50:40 Re: Deleting older versions in unique indexes to avoid page splits