pgsql: Fix spinlock assembly code for MIPS so it works on MIPS r6.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix spinlock assembly code for MIPS so it works on MIPS r6.
Date: 2019-06-23 00:32:17
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix spinlock assembly code for MIPS so it works on MIPS r6.

Original MIPS-I processors didn't have the LL/SC instructions (nor any
other userland synchronization primitive). If the build toolchain
targets that ISA variant by default, as an astonishingly large fraction
of MIPS platforms still do, the assembler won't take LL/SC without
coercion in the form of a ".set mips2" instruction. But we issued that
unconditionally, making it an ISA downgrade for chips later than MIPS2.
That breaks things for the latest MIPS r6 ISA, which encodes these
instructions differently. Adjust the code so we don't change ISA level
if it's >= 2.

Note that this patch doesn't change what happens on an actual MIPS-I
processor: either the kernel will emulate these instructions
transparently, or you'll get a SIGILL failure. That tradeoff seemed
fine in 2002 when this code was added (cf 3cbe6b247), and it's even
more so today when MIPS-I is basically extinct. But let's add a
comment about that.

YunQiang Su (with cosmetic adjustments by me). Back-patch to all
supported branches.

Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/40dde829070ddebd3f8bbf06d8e1cc4bff2e0c06

Modified Files
--------------
src/include/storage/s_lock.h | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2019-06-23 10:31:38 pgsql: Remove unnecessary comment.
Previous Message Noah Misch 2019-06-22 04:11:23 pgsql: Consolidate methods for translating a Perl path to a Windows pat