pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use auxv to check for CRC32 instructions on ARM.
Date: Fri, 22 Nov 2024 08:47:56 +0000
Message-ID: <E1tEPKW-00309I-V1@gemulon.postgresql.org> (raw)

Use auxv to check for CRC32 instructions on ARM.

Previously we probed for CRC32 instructions by testing if they caused
SIGILL.  Some have expressed doubts about that technique, the Linux
documentation advises not to use it, and it's not exactly beautiful.
Now that more operating systems expose CPU features to userspace via the
ELF loader in approximately the same way, let's use that instead.

This is expected to work on Linux, FreeBSD and recent OpenBSD.
OpenBSD/ARM has not been tested and is not present in our build farm,
but the API matches FreeBSD.

On macOS, compilers use a more recent baseline ISA so the runtime test
mechanism isn't reached.  (A similar situation is expected for
Windows/ARM when that port lands.)

On NetBSD, runtime feature probing is lost for armv8-a builds.  It looks
potentially doable with sysctl following the example of the cpuctl
program; patches are welcome.

No back-patch for now, since we don't have any evidence of actual
breakage from the previous technique.

Suggested-by: Bastien Roucariès <rouca@debian.org>
Discussion: https://postgr.es/m/4496616.iHFcN1HehY%40portable-bastien

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/aac831cafa6f3106dfcbd3298757801c299351fc

Modified Files
--------------
configure                         |  2 +-
configure.ac                      |  2 ++
meson.build                       |  2 ++
src/include/pg_config.h.in        |  6 ++++
src/port/pg_crc32c_armv8_choose.c | 66 ++++++++++++++-------------------------
5 files changed, 34 insertions(+), 44 deletions(-)



Message-ID: <E1tEPKW-00309I-V1@gemulon.postgresql.org>
Permalink:  ../E1tEPKW-00309I-V1@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tEPKW-00309I-V1@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use auxv to check for CRC32 instructions on ARM.
  In-Reply-To: <E1tEPKW-00309I-V1@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox