Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2023 01:25:39 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Martin Matuska <mm@freebsd.org>, Andrew Turner <andrew@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: 2a58b312b62f - main - zfs: merge openzfs/zfs@431083f75
Message-ID:  <CACNAnaFD5ZiH_RX94A4o4VOy_JF=CaF2W1Nv3--fGXihe7AUiw@mail.gmail.com>
In-Reply-To: <202304031513.333FD6qw014903@gitrepo.freebsd.org>
References:  <202304031513.333FD6qw014903@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Apr 3, 2023 at 10:13=E2=80=AFAM Martin Matuska <mm@freebsd.org> wro=
te:
>
> The branch main has been updated by mm:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=3D2a58b312b62f908ec92311d1bd=
8536dbaeb8e55b
>
> commit 2a58b312b62f908ec92311d1bd8536dbaeb8e55b
> Merge: b98fbf3781df 431083f75bdd
> Author:     Martin Matuska <mm@FreeBSD.org>
> AuthorDate: 2023-04-03 14:49:30 +0000
> Commit:     Martin Matuska <mm@FreeBSD.org>
> CommitDate: 2023-04-03 14:49:30 +0000
>
>     zfs: merge openzfs/zfs@431083f75
>
>     Notable upstream pull request merges:
> [... snip ...]
>       #13741 SHA2 reworking and API for iterating over multiple implement=
ations
> [... snip ...]

This one broke ZFS on aarch64, because kfpu_* are basically stubbed
out but should be using fpu_kern(9). I tried the below patch
(https://people.freebsd.org/~kevans/zfs-vfp.diff), but it doesn't
work. It seems to take a data abort while trying to fetch curthread in
kfpu_end() specifically in blake2. It looks like the blake2
implementation is probably clobbering x18, so pcpup is completely
bogus and it goes downhill from there. It's late and I don't know
off-hand how to cope with that, maybe Andy will have a better idea.

Thanks,

Kyle Evans

--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_aarch64.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_aarch64.h
@@ -44,13 +44,23 @@
 #define _FREEBSD_SIMD_AARCH64_H

 #include <sys/types.h>
+#include <sys/ucontext.h>
 #include <machine/elf.h>
+#include <machine/fpu.h>
 #include <machine/md_var.h>
+#include <machine/pcb.h>

 #define kfpu_allowed() 1
 #define kfpu_initialize(tsk) do {} while (0)
-#define kfpu_begin() do {} while (0)
-#define kfpu_end() do {} while (0)
+#define kfpu_begin() do { \
+ if (__predict_false(!is_fpu_kern_thread(0))) \
+ fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); \
+} while(0)
+
+#define kfpu_end() do { \
+ if (__predict_false(curthread->td_pcb->pcb_fpflags & PCB_FP_NOSAVE)) \
+ fpu_kern_leave(curthread, NULL); \
+} while(0)
 #define kfpu_init() (0)
 #define kfpu_fini() do {} while (0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFD5ZiH_RX94A4o4VOy_JF=CaF2W1Nv3--fGXihe7AUiw>