aboutsummaryrefslogtreecommitdiffstats
path: root/module/zcommon/zfs_fletcher_sse.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_sse.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_sse.c')
-rw-r--r--module/zcommon/zfs_fletcher_sse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zcommon/zfs_fletcher_sse.c b/module/zcommon/zfs_fletcher_sse.c
index 6c78830be..096472c9a 100644
--- a/module/zcommon/zfs_fletcher_sse.c
+++ b/module/zcommon/zfs_fletcher_sse.c
@@ -53,7 +53,6 @@ ZFS_NO_SANITIZE_UNDEFINED
static void
fletcher_4_sse2_init(fletcher_4_ctx_t *ctx)
{
- kfpu_begin();
memset(ctx->sse, 0, 4 * sizeof (zfs_fletcher_sse_t));
}
@@ -81,7 +80,6 @@ fletcher_4_sse2_fini(fletcher_4_ctx_t *ctx, zio_cksum_t *zcp)
8 * ctx->sse[2].v[1] + ctx->sse[1].v[1];
ZIO_SET_CHECKSUM(zcp, A, B, C, D);
- kfpu_end();
}
#define FLETCHER_4_SSE_RESTORE_CTX(ctx) \
@@ -164,6 +162,7 @@ const fletcher_4_ops_t fletcher_4_sse2_ops = {
.fini_byteswap = fletcher_4_sse2_fini,
.compute_byteswap = fletcher_4_sse2_byteswap,
.valid = fletcher_4_sse2_valid,
+ .uses_fpu = B_TRUE,
.name = "sse2"
};
@@ -218,6 +217,7 @@ const fletcher_4_ops_t fletcher_4_ssse3_ops = {
.fini_byteswap = fletcher_4_sse2_fini,
.compute_byteswap = fletcher_4_ssse3_byteswap,
.valid = fletcher_4_ssse3_valid,
+ .uses_fpu = B_TRUE,
.name = "ssse3"
};