aboutsummaryrefslogtreecommitdiffstats
path: root/module/zcommon/zfs_fletcher_avx512.c
diff options
context:
space:
mode:
authorAttila Fülöp <[email protected]>2023-03-14 17:45:28 +0100
committerGitHub <[email protected]>2023-03-14 09:45:28 -0700
commit78289b84589e632d87504df6a9c63b5ac694d2f9 (patch)
tree92c27ba84107a5fc63c83be70dfe11e6ec4e278b /module/zcommon/zfs_fletcher_avx512.c
parentb15ab50c4d61729ae831ea76968b9fa4867d61cf (diff)
zcommon: Refactor FPU state handling in fletcher4
Currently calls to kfpu_begin() and kfpu_end() are split between the init() and fini() functions of the particular SIMD implementation. This was done in #14247 as an optimization measure for the ABD adapter. Unfortunately the split complicates FPU handling on platforms that use a local FPU state buffer, like Windows and macOS. To ease porting, we introduce a boolean struct member in fletcher_4_ops_t, indicating use of the FPU, and move the FPU state handling from the SIMD implementations to the call sites. Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Jorgen Lundman <[email protected]> Signed-off-by: Attila Fülöp <[email protected]> Closes #14600
Diffstat (limited to 'module/zcommon/zfs_fletcher_avx512.c')
-rw-r--r--module/zcommon/zfs_fletcher_avx512.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zcommon/zfs_fletcher_avx512.c b/module/zcommon/zfs_fletcher_avx512.c
index 4a3d5cb24..81182ead2 100644
--- a/module/zcommon/zfs_fletcher_avx512.c
+++ b/module/zcommon/zfs_fletcher_avx512.c
@@ -39,7 +39,6 @@ ZFS_NO_SANITIZE_UNDEFINED
static void
fletcher_4_avx512f_init(fletcher_4_ctx_t *ctx)
{
- kfpu_begin();
memset(ctx->avx512, 0, 4 * sizeof (zfs_fletcher_avx512_t));
}
@@ -73,7 +72,6 @@ fletcher_4_avx512f_fini(fletcher_4_ctx_t *ctx, zio_cksum_t *zcp)
}
ZIO_SET_CHECKSUM(zcp, A, B, C, D);
- kfpu_end();
}
#define FLETCHER_4_AVX512_RESTORE_CTX(ctx) \
@@ -166,6 +164,7 @@ const fletcher_4_ops_t fletcher_4_avx512f_ops = {
.fini_byteswap = fletcher_4_avx512f_fini,
.compute_byteswap = fletcher_4_avx512f_byteswap,
.valid = fletcher_4_avx512f_valid,
+ .uses_fpu = B_TRUE,
.name = "avx512f"
};
@@ -216,6 +215,7 @@ const fletcher_4_ops_t fletcher_4_avx512bw_ops = {
.fini_byteswap = fletcher_4_avx512f_fini,
.compute_byteswap = fletcher_4_avx512bw_byteswap,
.valid = fletcher_4_avx512bw_valid,
+ .uses_fpu = B_TRUE,
.name = "avx512bw"
};
#endif