summaryrefslogtreecommitdiff
path: root/arch/s390/kernel/process.c
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2024-02-03 11:45:12 +0100
committerHeiko Carstens <hca@linux.ibm.com>2024-02-16 14:30:15 +0100
commit4eed43de9ba0ae3af6716544408d185a152424cd (patch)
treeee2921767b33f83258559e00906400ca8b7ce84b /arch/s390/kernel/process.c
parentc038b984a9af1010555986d6fe32d4da9db9fc3d (diff)
s390/fpu: make kernel fpu context preemptible
Make the kernel fpu context preemptible. Add another fpu structure to the thread_struct, and use it to save and restore the kernel fpu context if its task uses fpu registers when it is preempted. Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/process.c')
-rw-r--r--arch/s390/kernel/process.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 62146daf9051..b7b623818753 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -95,6 +95,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
*dst = *src;
dst->thread.ufpu.regs = dst->thread.ufpu.fprs;
+ dst->thread.kfpu_flags = 0;
/*
* Don't transfer over the runtime instrumentation or the guarded
@@ -197,10 +198,12 @@ void execve_tail(void)
struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next)
{
save_user_fpu_regs();
+ save_kernel_fpu_regs(&prev->thread);
save_access_regs(&prev->thread.acrs[0]);
save_ri_cb(prev->thread.ri_cb);
save_gs_cb(prev->thread.gs_cb);
update_cr_regs(next);
+ restore_kernel_fpu_regs(&next->thread);
restore_access_regs(&next->thread.acrs[0]);
restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb);
restore_gs_cb(next->thread.gs_cb);