pgsql: Further improve code for probing the availability of ARM CRC ins

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Further improve code for probing the availability of ARM CRC ins
Date: 2018-05-03 15:33:02
Message-ID: E1fEGEA-0001Is-Vl@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Further improve code for probing the availability of ARM CRC instructions.

Andrew Gierth pointed out that commit 1c72ec6f4 would yield the wrong
answer on big-endian ARM systems, because the data being CRC'd would be
different. To fix that, and avoid the rather unsightly hard-wired
constant, simply compare the hardware and software implementations'
results.

While we're at it, also log the resulting decision at DEBUG1, and error
out if the hw and sw results unexpectedly differ. Also, since this
file must compile for both frontend and backend, avoid incorrect
dependencies on backend-only headers.

In passing, add a comment to postmaster.c about when the CRC function
pointer will get initialized.

Thomas Munro, based on complaints from Andrew Gierth and Tom Lane

Discussion: https://postgr.es/m/HE1PR0801MB1323D171938EABC04FFE7FA9E3110@HE1PR0801MB1323.eurprd08.prod.outlook.com

Branch
------
master

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

Modified Files
--------------
src/backend/postmaster/postmaster.c | 10 +++++++++-
src/port/pg_crc32c_armv8_choose.c | 37 ++++++++++++++++++++++++++++++-------
2 files changed, 39 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Teodor Sigaev 2018-05-03 15:37:49 pgsql: Fix pg_dump support for pre-8.2 versions
Previous Message Peter Eisentraut 2018-05-03 13:36:17 Re: pgsql: Clean up warnings from -Wimplicit-fallthrough.