Re: BUG #15844: MIPS: remove .set mips2 in s_lock.h to fix r6 build

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: YunQiang Su <wzssyqa@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-bugs@lists.postgresql.org
Date: 2019-06-22T22:37:07Z
Lists: pgsql-bugs

Attachments

I wrote:
> So the gcc guys aren't any more wedded than we are to the rule that
> one must not generate LL/SC on MIPS-I.  They're probably assuming the
> same thing we are, which is that if you're actually doing this on
> MIPS-I then you'll get an instruction trap and the kernel will
> emulate it for you.

Actually, after further contemplating that argument (which I was reminded
of by excavating in our commit log), I realize that having a .set mips2
in the ASM is actually the right way to do this, because that only results
in LL/SC getting emulated when we need them to be.  Forcing -march=mips2
across the entire Postgres build would exceed our authority really ---
yeah, it might produce better code quality, but it's not our business to
override platform-level target architecture decisions.

So I now think your original proposal was about the best way to do this,
though I'd tweak it to make the test be "#if __mips_isa_rev < 2", as
attached.  It doesn't seem like forcing the ISA level down is ever
something we want to do, even if we know there's no practical difference.

			regards, tom lane

Commits

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