Re: Detection of hadware feature => please do not use signal
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Bastien Roucariès <rouca@debian.org>, pgsql-bugs@lists.postgresql.org
Date: 2024-11-07T00:01:58Z
Lists: pgsql-bugs
Attachments
- 0001-Use-auxv-to-check-for-CRC32-instructions-on-ARM.patch (text/x-patch) patch 0001
On Sat, Nov 2, 2024 at 6:11 PM Thomas Munro <thomas.munro@gmail.com> wrote: > In the meantime I'll see about the Linux/*BSD patch for this thing, Here is a patch, tested on Debian 12 and FreeBSD 15 and observed to return true here as expected. It might be hard to find a machine where it returns false. From some quick googling, only the first generation of 64 bit designs eg Cortex A53 lacked CRC32, so I tried booting in qemu with -cpu cortex-a53 but alas its emulation appears to be inaccurate there (both software emulation and hypervisor, features as reported in dmesg) and unlike other fancy instructions qemu lacks an off switch for that specific feature. I guess someone who wants to see false there would need to compile on an old Chromebook or similar! It doesn't look like I need to include <asm/hwcap.h> from Bastien's original message, because <sys/auxv.h> pulls in <bits/hwcap.h> already. The man pages are pretty useless on this topic, but I'd rather avoid more configure tests if possible and FreeBSD has those constants in <machine/elf.h>, which it also pulls in already with just #include <sys/auxv.h>. I don't have an OpenBSD/aarch64 setup to test (neither does our build farm) but I'm pretty sure from browsing their code on github that this'll just work; it has the same <sys/auxv.h> and <machine/elf.h> setup and all the same names for everything.
Commits
-
Update configure probes for CFLAGS needed for ARM CRC instructions.
- e266a0ed67d2 17.3 landed
- 851c6ff18fd3 15.11 landed
- 5980f1884fc9 18.0 landed
- 32057a0f791e 13.19 landed
- 2fc0199a5015 14.16 landed
- 1f4aadec41b8 16.7 landed
-
Support runtime CRC feature probing on NetBSD/ARM using sysctl().
- 4570b22666dd 18.0 landed
-
Use auxv to check for CRC32 instructions on ARM.
- aac831cafa6f 18.0 landed
-
Improve our method for probing the availability of ARM CRC instructions.
- 1c72ec6f4989 11.0 cited