From 242aeaae19d46d73b368505a9fa485e4afca2935 Mon Sep 17 00:00:00 2001 From: Pavel Reichl Date: Mon, 24 Oct 2022 15:22:12 +0200 Subject: [PATCH] Fix fio failure with --verify=crc32c on arm Resolves: rhbz#1974189 Signed-off-by: Pavel Reichl --- 0001-fio-os-detect-pmull-suooprt-on-arm.patch | 53 +++++++++++++++++++ fio.spec | 7 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 0001-fio-os-detect-pmull-suooprt-on-arm.patch diff --git a/0001-fio-os-detect-pmull-suooprt-on-arm.patch b/0001-fio-os-detect-pmull-suooprt-on-arm.patch new file mode 100644 index 0000000..4da0f2d --- /dev/null +++ b/0001-fio-os-detect-pmull-suooprt-on-arm.patch @@ -0,0 +1,53 @@ +From 3721c7fe276dbbc93e584359f87913e58f96626e Mon Sep 17 00:00:00 2001 +From: Sitsofe Wheeler +Date: Mon, 6 Dec 2021 20:02:53 +0000 +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 808f1d022..3001140ca 100644 +--- a/os/os-linux.h ++++ b/os/os-linux.h +@@ -20,6 +20,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 */ +@@ -405,7 +408,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: diff --git a/fio.spec b/fio.spec index 11e46e4..8d360c0 100644 --- a/fio.spec +++ b/fio.spec @@ -1,6 +1,6 @@ Name: fio Version: 3.27 -Release: 7%{?dist} +Release: 8%{?dist} Summary: Multithreaded IO generation tool License: GPLv2 @@ -10,6 +10,7 @@ Source: http://brick.kernel.dk/snaps/%{name}-%{version}.tar.bz2 Patch0: 0001-ioengines-fix-crash-with-enghelp-option.patch Patch1: 0001-fio-remove-raw-device-support.patch Patch2: 0001-fio-use-LDFLAGS-when-linking-dynamic-engines.patch +Patch3: 0001-fio-os-detect-pmull-suooprt-on-arm.patch BuildRequires: gcc BuildRequires: libaio-devel @@ -211,6 +212,10 @@ make install prefix=%{_prefix} mandir=%{_mandir} libdir=%{_libdir}/fio DESTDIR=$ %endif %changelog +* Mon Oct 24 2022 Pavel Reichl - 3.27-8 +- Fix fio failure with --verify=crc32c on arm + Related: rhbz#1974189 + * Tue Feb 08 2022 Eric Sandeen - 3.27.7 - Use LDFLAGS when linking dynamic engines Related: rhbz#2044858