From 4e6ed6e6e8bf4513504a8a0b40cde13e523d2b7f Mon Sep 17 00:00:00 2001 From: cenhuilin Date: Wed, 20 Mar 2024 16:31:21 +0800 Subject: [PATCH] fix fio failure with --verify=crc32c on arm --- backport-os-detect-pmull-suooprt-on-arm.patch | 55 +++++++++++++++++++ fio.spec | 8 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 backport-os-detect-pmull-suooprt-on-arm.patch diff --git a/backport-os-detect-pmull-suooprt-on-arm.patch b/backport-os-detect-pmull-suooprt-on-arm.patch new file mode 100644 index 0000000..e11b652 --- /dev/null +++ b/backport-os-detect-pmull-suooprt-on-arm.patch @@ -0,0 +1,55 @@ +From fc6ccf25764b67184ce8cf2431ce6fbd315db0ad Mon Sep 17 00:00:00 2001 +From: Sitsofe Wheeler +Date: Wed, 20 Mar 2024 16:20:16 +0800 +Subject: [PATCH] os: detect PMULL support before enabling accelerated crc32c on ARM + +Issue #1239 shows a crash on a FUJITSU/A64FX ARM platform at the +following line: + +crc/crc32c-arm64.c: + 64 t1 = (uint64_t)vmull_p64(crc1, k2); + +On armv8 PMULL crypto instructions like vmull_p64 are defined as +optional (see +https://github.com/google/crc32c/pull/6#issuecomment-328713398 and +https://github.com/dotnet/runtime/issues/35143#issuecomment-617263508 ). + +Avoid the crash by gating use of the hardware accelerated ARM crc32c +path behind runtime detection of PMULL. + +Fixes: https://github.com/axboe/fio/issues/1239 + +Signed-off-by: Sitsofe Wheeler +Signed-off-by: Pavel Reichl +Tested-by: Yi Zhang +--- + os/os-linux.h | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/os/os-linux.h b/os/os-linux.h +index a550bba..958aaa1 100644 +--- a/os/os-linux.h ++++ b/os/os-linux.h +@@ -21,6 +21,9 @@ + + #ifdef ARCH_HAVE_CRC_CRYPTO + #include ++#ifndef HWCAP_PMULL ++#define HWCAP_PMULL (1 << 4) ++#endif /* HWCAP_PMULL */ + #ifndef HWCAP_CRC32 + #define HWCAP_CRC32 (1 << 7) + #endif /* HWCAP_CRC32 */ +@@ -425,7 +428,8 @@ static inline bool os_cpu_has(cpu_features feature) + #ifdef ARCH_HAVE_CRC_CRYPTO + case CPU_ARM64_CRC32C: + hwcap = getauxval(AT_HWCAP); +- have_feature = (hwcap & HWCAP_CRC32) != 0; ++ have_feature = (hwcap & (HWCAP_PMULL | HWCAP_CRC32)) == ++ (HWCAP_PMULL | HWCAP_CRC32); + break; + #endif + default: +-- +2.27.0 + diff --git a/fio.spec b/fio.spec index f78ea62..ef60038 100644 --- a/fio.spec +++ b/fio.spec @@ -1,10 +1,13 @@ Name: fio Version: 3.7 -Release: 7 +Release: 8 Summary: Versatile IO workload generator License: GPLv2 URL: http://git.kernel.dk/?p=fio.git;a=summary Source: http://brick.kernel.dk/snaps/%{name}-%{version}.tar.bz2 + +Patch0: backport-os-detect-pmull-suooprt-on-arm.patch + BuildRequires: libaio-devel zlib-devel librbd1-devel numactl-devel librdmacm-devel %ifarch x86_64 @@ -46,6 +49,9 @@ export EXTFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" %{_mandir}/man1/* %changelog +* Wed Mar 20 2024 cenhuilin - 3.7-8 +- fix fio failure with --verify=crc32c on arm + * Wed Jul 21 2021 lingsheng - 3.7-7 - Remove unnecessary buildrequire gdb -- Gitee