diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-16 15:22:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-16 15:22:48 -0500 |
commit | b6c66418dcad0fcf83cd1d0a39482db37bf4fc41 (patch) | |
tree | 0a23207a2ab766341fbf60d76b2c10984ec6e5ca /arch/x86 | |
parent | 15d8791cae75dca27bfda8ecfe87dca9379d6bb0 (diff) |
i387: move TS_USEDFPU clearing out of __save_init_fpu and into callers
Touching TS_USEDFPU without touching CR0.TS is confusing, so don't do
it. By moving it into the callers, we always do the TS_USEDFPU next to
the CR0.TS accesses in the source code, and it's much easier to see how
the two go hand in hand.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/i387.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h index f704be239883..1e12c2d087e4 100644 --- a/arch/x86/include/asm/i387.h +++ b/arch/x86/include/asm/i387.h | |||
@@ -259,7 +259,6 @@ static inline void fpu_save_init(struct fpu *fpu) | |||
259 | static inline void __save_init_fpu(struct task_struct *tsk) | 259 | static inline void __save_init_fpu(struct task_struct *tsk) |
260 | { | 260 | { |
261 | fpu_save_init(&tsk->thread.fpu); | 261 | fpu_save_init(&tsk->thread.fpu); |
262 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
263 | } | 262 | } |
264 | 263 | ||
265 | static inline int fpu_fxrstor_checking(struct fpu *fpu) | 264 | static inline int fpu_fxrstor_checking(struct fpu *fpu) |
@@ -290,6 +289,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk) | |||
290 | { | 289 | { |
291 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | 290 | if (task_thread_info(tsk)->status & TS_USEDFPU) { |
292 | __save_init_fpu(tsk); | 291 | __save_init_fpu(tsk); |
292 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
293 | stts(); | 293 | stts(); |
294 | } else | 294 | } else |
295 | tsk->fpu_counter = 0; | 295 | tsk->fpu_counter = 0; |
@@ -356,9 +356,11 @@ static inline void kernel_fpu_begin(void) | |||
356 | 356 | ||
357 | WARN_ON_ONCE(!irq_fpu_usable()); | 357 | WARN_ON_ONCE(!irq_fpu_usable()); |
358 | preempt_disable(); | 358 | preempt_disable(); |
359 | if (me->status & TS_USEDFPU) | 359 | if (me->status & TS_USEDFPU) { |
360 | __save_init_fpu(me->task); | 360 | __save_init_fpu(me->task); |
361 | else | 361 | me->status &= ~TS_USEDFPU; |
362 | /* We do 'stts()' in kernel_fpu_end() */ | ||
363 | } else | ||
362 | clts(); | 364 | clts(); |
363 | } | 365 | } |
364 | 366 | ||
@@ -449,6 +451,7 @@ static inline void save_init_fpu(struct task_struct *tsk) | |||
449 | WARN_ON_ONCE(!(task_thread_info(tsk)->status & TS_USEDFPU)); | 451 | WARN_ON_ONCE(!(task_thread_info(tsk)->status & TS_USEDFPU)); |
450 | preempt_disable(); | 452 | preempt_disable(); |
451 | __save_init_fpu(tsk); | 453 | __save_init_fpu(tsk); |
454 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
452 | stts(); | 455 | stts(); |
453 | preempt_enable(); | 456 | preempt_enable(); |
454 | } | 457 | } |