Re: Detection of hadware feature => please do not use signal

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Bastien Roucariès <rouca(at)debian(dot)org>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Detection of hadware feature => please do not use signal
Date: 2024-11-07 00:01:58
Message-ID: CA+hUKGLKjuZACHB559EzFFgzGzk20Qr-S5fqg4C-F7sAg4q6+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Nov 2, 2024 at 6:11 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)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.

Attachment Content-Type Size
0001-Use-auxv-to-check-for-CRC32-instructions-on-ARM.patch text/x-patch 5.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jan Behrens 2024-11-07 01:23:44 Re: BUG #18693: Column names not set when using SELECT STRICT INTO with RECORD type
Previous Message Tom Lane 2024-11-06 22:30:02 Re: BUG #18693: Column names not set when using SELECT STRICT INTO with RECORD type