mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-34565 MariaDB crashes with SIGILL because the OS does not support AVX512
In commit 232d7a5e2d
we almost got
the detection logic right. However, the XGETBV instruction would
crash if Linux was started up with the option noxsave.
have_vpclmulqdq(): Check for the XSAVE flag at the correct position
and also for the AVX flag.
This was tested on Ubuntu 22.04 by starting up its Linux 5.15 kernel
with and without the noxsave option.
This commit is contained in:
parent
ae02999cdb
commit
b68c100076
1 changed files with 2 additions and 2 deletions
|
@ -39,7 +39,7 @@ extern "C" unsigned crc32c_sse42(unsigned crc, const void* buf, size_t size);
|
|||
|
||||
constexpr uint32_t cpuid_ecx_SSE42= 1U << 20;
|
||||
constexpr uint32_t cpuid_ecx_SSE42_AND_PCLMUL= cpuid_ecx_SSE42 | 1U << 1;
|
||||
constexpr uint32_t cpuid_ecx_XSAVE= 1U << 26;
|
||||
constexpr uint32_t cpuid_ecx_AVX_AND_XSAVE= 1U << 28 | 1U << 27;
|
||||
|
||||
static uint32_t cpuid_ecx()
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ static bool os_have_avx512()
|
|||
|
||||
static ATTRIBUTE_NOINLINE bool have_vpclmulqdq(uint32_t cpuid_ecx)
|
||||
{
|
||||
if (!(cpuid_ecx & cpuid_ecx_XSAVE) || !os_have_avx512())
|
||||
if ((~cpuid_ecx & cpuid_ecx_AVX_AND_XSAVE) || !os_have_avx512())
|
||||
return false;
|
||||
# ifdef _MSC_VER
|
||||
int regs[4];
|
||||
|
|
Loading…
Add table
Reference in a new issue