[pve-devel] [PATCH zfsonlinux] [SIMD]: FPU register save/restore is also required on 5.0 kernels

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Sep 27 14:27:26 CEST 2019


Acked-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>

On September 27, 2019 12:49 pm, Thomas Lamprecht wrote:
> Do a very minimal fix, effectively just making the code path for 5.0
> to 5.1 and 5.2 to 5.3 the same one, which can be done by backporting
> the new copy_kernel helpers into the kernel, as the existing ones are
> indirectly exported as GPL symbol
> 
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  ...r-save-restore-is-also-required-on-5.patch | 57 +++++++++++++++++++
>  debian/patches/series                         |  1 +
>  2 files changed, 58 insertions(+)
>  create mode 100644 debian/patches/0010-SIMD-FPU-register-save-restore-is-also-required-on-5.patch
> 
> diff --git a/debian/patches/0010-SIMD-FPU-register-save-restore-is-also-required-on-5.patch b/debian/patches/0010-SIMD-FPU-register-save-restore-is-also-required-on-5.patch
> new file mode 100644
> index 0000000..87c8af1
> --- /dev/null
> +++ b/debian/patches/0010-SIMD-FPU-register-save-restore-is-also-required-on-5.patch
> @@ -0,0 +1,57 @@
> +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
> +From: Thomas Lamprecht <t.lamprecht at proxmox.com>
> +Date: Wed, 25 Sep 2019 10:48:48 +0200
> +Subject: [PATCH] [SIMD]: FPU register save/restore is also required on 5.0
> + kernels
> +
> +NOTE: the kernel needs to have the copy_kernel_to_xregs_err,
> +copy_kernel_to_fxregs_err and copy_kernel_to_fregs_err funcitons
> +backported for this to work.
> +
> +Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> +---
> + include/linux/simd_x86.h | 11 +----------
> + 1 file changed, 1 insertion(+), 10 deletions(-)
> +
> +diff --git a/include/linux/simd_x86.h b/include/linux/simd_x86.h
> +index 5f243e0cc..aac63d964 100644
> +--- a/include/linux/simd_x86.h
> ++++ b/include/linux/simd_x86.h
> +@@ -179,7 +179,6 @@ kfpu_begin(void)
> + 	preempt_disable();
> + 	local_irq_disable();
> + 
> +-#if defined(HAVE_KERNEL_TIF_NEED_FPU_LOAD)
> + 	/*
> + 	 * The current FPU registers need to be preserved by kfpu_begin()
> + 	 * and restored by kfpu_end().  This is required because we can
> +@@ -188,20 +187,13 @@ kfpu_begin(void)
> + 	 * context switch.
> + 	 */
> + 	copy_fpregs_to_fpstate(&current->thread.fpu);
> +-#elif defined(HAVE_KERNEL_FPU_INITIALIZED)
> +-	/*
> +-	 * There is no need to preserve and restore the FPU registers.
> +-	 * They will always be restored from the task's stored FPU state
> +-	 * when switching contexts.
> +-	 */
> ++
> + 	WARN_ON_ONCE(current->thread.fpu.initialized == 0);
> +-#endif
> + }
> + 
> + static inline void
> + kfpu_end(void)
> + {
> +-#if defined(HAVE_KERNEL_TIF_NEED_FPU_LOAD)
> + 	union fpregs_state *state = &current->thread.fpu.state;
> + 	int error;
> + 
> +@@ -213,7 +205,6 @@ kfpu_end(void)
> + 		error = copy_kernel_to_fregs_err(&state->fsave);
> + 	}
> + 	WARN_ON_ONCE(error);
> +-#endif
> + 
> + 	local_irq_enable();
> + 	preempt_enable();
> diff --git a/debian/patches/series b/debian/patches/series
> index 9b0d7fb..c65e410 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -7,3 +7,4 @@
>  0007-Fix-race-in-parallel-mount-s-thread-dispatching-algo.patch
>  0008-Linux-5.0-compat-SIMD-compatibility.patch
>  0009-Fix-CONFIG_X86_DEBUG_FPU-build-failure.patch
> +0010-SIMD-FPU-register-save-restore-is-also-required-on-5.patch
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list