Re: Detection of hadware feature => please do not use signal
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Bastien Roucariès <rouca@debian.org>, pgsql-bugs@lists.postgresql.org
Date: 2024-11-23T05:50:46Z
Lists: pgsql-bugs
Thomas Munro <thomas.munro@gmail.com> writes: > (Nerd sniped) No NetBSD here but think a 32 bit kernel should expose > sysctl machdep.id_isar, which should be an array of 6 ints, and bits > 16-19 of id_isar[5] should give you the answer: Huh. cpuctl's arm32 module knows of machdep.id_isar, but it does not appear to know that that word exists: http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/cpuctl/arch/arm.c?rev=1.6;content-type=text%2Fplain But that developer.arm.com page seems pretty definitive. Tomorrow I'll have a go at spinning up a 32-bit NetBSD installation and test it. Thanks for the research! > Since you included <aarch64/armreg.h>, and only care about non-zero, > couldn't you use the mask from the header, instead of all that > bitswizzling? > return (id->ac_aa64isar0 & ID_AA64ISAR0_EL1_CRC32) != 0; I didn't actually look into that header ;-) ... I was just basing this on what cpuctl's code does. That version does look cleaner, at least for aarch64 --- but given that the field is defined to be in the same place in the relevant register for each arch, I'm a bit inclined to keep the bit-swizzling and just have two paths for getting the register contents. Unless maybe that header is also installed in arm32 builds, in which case we could do it as you show for both arches. I'll find out mañana. regards, tom lane
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