diff options
author | Matthew Macy <[email protected]> | 2020-09-23 11:09:48 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-10-01 12:18:51 -0700 |
commit | 227273efa4857d97522a4d18ea0b40152d7458ca (patch) | |
tree | 3adad5d47f6ef3c3ec7936ccb9d76ed94bb72b87 /include | |
parent | b199e62d17dc6bf098c345002db22e8d4540e8ce (diff) |
FreeBSD: Don't save user FPU context in kernel threads
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #10899
Diffstat (limited to 'include')
-rw-r--r-- | include/os/freebsd/spl/sys/simd_x86.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/os/freebsd/spl/sys/simd_x86.h b/include/os/freebsd/spl/sys/simd_x86.h index a35e205d5..63d6017b7 100644 --- a/include/os/freebsd/spl/sys/simd_x86.h +++ b/include/os/freebsd/spl/sys/simd_x86.h @@ -29,6 +29,7 @@ #include <sys/cdefs.h> #include <sys/types.h> #include <sys/systm.h> +#include <sys/proc.h> #ifdef __i386__ #include <x86/fpu.h> #else @@ -42,16 +43,15 @@ #define kfpu_allowed() 1 #define kfpu_initialize(tsk) do {} while (0) -#define kfpu_begin() { \ - critical_enter(); \ - fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX); \ +#define kfpu_begin() { \ + if (__predict_false(!is_fpu_kern_thread(0))) \ + fpu_kern_enter(curthread, NULL, FPU_KERN_NOCTX);\ } -#define kfpu_end() \ - { \ - fpu_kern_leave(curthread, NULL); \ - critical_exit(); \ - } +#define kfpu_end() { \ + if (__predict_false(curpcb->pcb_flags & PCB_FPUNOSAVE)) \ + fpu_kern_leave(curthread, NULL); \ +} /* * Check if OS supports AVX and AVX2 by checking XCR0 |