summaryrefslogtreecommitdiff
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-02-16 13:33:12 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-27 10:25:54 -0800
commit29515b215b9bbbad0368a5039ba6e53ed3fa7f25 (patch)
treeceb3e10f27365a1746f4bc5fe89636430750a339 /arch/x86/kernel
parent38358b6185298df66ef4ddb4ceaaa1baf8521b28 (diff)
i387: don't ever touch TS_USEDFPU directly, use helper functions
commit 6d59d7a9f5b723a7ac1925c136e93ec83c0c3043 upstream. This creates three helper functions that do the TS_USEDFPU accesses, and makes everybody that used to do it by hand use those helpers instead. In addition, there's a couple of helper functions for the "change both CR0.TS and TS_USEDFPU at the same time" case, and the places that do that together have been changed to use those. That means that we have fewer random places that open-code this situation. The intent is partly to clarify the code without actually changing any semantics yet (since we clearly still have some hard to reproduce bug in this area), but also to make it much easier to use another approach entirely to caching the CR0.TS bit for software accesses. Right now we use a bit in the thread-info 'status' variable (this patch does not change that), but we might want to make it a full field of its own or even make it a per-cpu variable. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/traps.c2
-rw-r--r--arch/x86/kernel/xsave.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 727e6c16f294..bb5445c5450d 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -579,7 +579,7 @@ void __math_state_restore(void)
return;
}
- thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */
+ __thread_set_has_fpu(thread); /* clts in caller! */
tsk->fpu_counter++;
}
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 86f1f09a738a..a0bcd0dbc951 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -47,7 +47,7 @@ void __sanitize_i387_state(struct task_struct *tsk)
if (!fx)
return;
- BUG_ON(task_thread_info(tsk)->status & TS_USEDFPU);
+ BUG_ON(__thread_has_fpu(task_thread_info(tsk)));
xstate_bv = tsk->thread.fpu.state->xsave.xsave_hdr.xstate_bv;