mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Linux 4.14, 4.19, 5.0+ compat: SIMD save/restore
Contrary to initial testing we cannot rely on these kernels to invalidate the per-cpu FPU state and restore the FPU registers. Nor can we guarantee that the kernel won't modify the FPU state which we saved in the task struck. Therefore, the kfpu_begin() and kfpu_end() functions have been updated to save and restore the FPU state using our own dedicated per-cpu FPU state variables. This has the additional advantage of allowing us to use the FPU again in user threads. So we remove the code which was added to use task queues to ensure some functions ran in kernel threads. Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #9346 Closes #9403
This commit is contained in:
+3
-29
@@ -206,35 +206,9 @@ aes_mod_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#if defined(_KERNEL)
|
||||
/*
|
||||
* Determine the fastest available implementation. The benchmarks
|
||||
* are run in dedicated kernel threads to allow Linux 5.0+ kernels
|
||||
* to use SIMD operations. If for some reason this isn't possible,
|
||||
* fallback to the generic implementations. See the comment in
|
||||
* linux/simd_x86.h for additional details. Additionally, this has
|
||||
* the benefit of allowing them to be run in parallel.
|
||||
*/
|
||||
taskqid_t aes_id = taskq_dispatch(system_taskq, aes_impl_init,
|
||||
NULL, TQ_SLEEP);
|
||||
taskqid_t gcm_id = taskq_dispatch(system_taskq, gcm_impl_init,
|
||||
NULL, TQ_SLEEP);
|
||||
|
||||
if (aes_id != TASKQID_INVALID) {
|
||||
taskq_wait_id(system_taskq, aes_id);
|
||||
} else {
|
||||
aes_impl_init(NULL);
|
||||
}
|
||||
|
||||
if (gcm_id != TASKQID_INVALID) {
|
||||
taskq_wait_id(system_taskq, gcm_id);
|
||||
} else {
|
||||
gcm_impl_init(NULL);
|
||||
}
|
||||
#else
|
||||
aes_impl_init(NULL);
|
||||
gcm_impl_init(NULL);
|
||||
#endif
|
||||
/* Determine the fastest available implementation. */
|
||||
aes_impl_init();
|
||||
gcm_impl_init();
|
||||
|
||||
if ((ret = mod_install(&modlinkage)) != 0)
|
||||
return (ret);
|
||||
|
||||
Reference in New Issue
Block a user