Skip to content

Commit 54f565e

Browse files
William Lee Irwin IIIdavem330
authored andcommitted
[SPARC]: Fix TIF_USEDFPU flag atomicity
From: William Lee Irwin III <wli@holomorphy.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c0a79b2 commit 54f565e

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

‎arch/sparc/kernel/process.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void exit_thread(void)
348348
#ifndef CONFIG_SMP
349349
if(last_task_used_math == current) {
350350
#else
351-
if(current_thread_info()->flags & _TIF_USEDFPU) {
351+
if (test_thread_flag(TIF_USEDFPU)) {
352352
#endif
353353
/* Keep process from leaving FPU in a bogon state. */
354354
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
357357
#ifndef CONFIG_SMP
358358
last_task_used_math = NULL;
359359
#else
360-
current_thread_info()->flags &= ~_TIF_USEDFPU;
360+
clear_thread_flag(TIF_USEDFPU);
361361
#endif
362362
}
363363
}
@@ -371,7 +371,7 @@ void flush_thread(void)
371371
#ifndef CONFIG_SMP
372372
if(last_task_used_math == current) {
373373
#else
374-
if(current_thread_info()->flags & _TIF_USEDFPU) {
374+
if (test_thread_flag(TIF_USEDFPU)) {
375375
#endif
376376
/* Clean the fpu. */
377377
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
380380
#ifndef CONFIG_SMP
381381
last_task_used_math = NULL;
382382
#else
383-
current_thread_info()->flags &= ~_TIF_USEDFPU;
383+
clear_thread_flag(TIF_USEDFPU);
384384
#endif
385385
}
386386

@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
466466
#ifndef CONFIG_SMP
467467
if(last_task_used_math == current) {
468468
#else
469-
if(current_thread_info()->flags & _TIF_USEDFPU) {
469+
if (test_thread_flag(TIF_USEDFPU)) {
470470
#endif
471471
put_psr(get_psr() | PSR_EF);
472472
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
473473
&p->thread.fpqueue[0], &p->thread.fpqdepth);
474474
#ifdef CONFIG_SMP
475-
current_thread_info()->flags &= ~_TIF_USEDFPU;
475+
clear_thread_flag(TIF_USEDFPU);
476476
#endif
477477
}
478478

@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
609609
return 1;
610610
}
611611
#ifdef CONFIG_SMP
612-
if (current_thread_info()->flags & _TIF_USEDFPU) {
612+
if (test_thread_flag(TIF_USEDFPU)) {
613613
put_psr(get_psr() | PSR_EF);
614614
fpsave(&current->thread.float_regs[0], &current->thread.fsr,
615615
&current->thread.fpqueue[0], &current->thread.fpqdepth);
616616
if (regs != NULL) {
617617
regs->psr &= ~(PSR_EF);
618-
current_thread_info()->flags &= ~(_TIF_USEDFPU);
618+
clear_thread_flag(TIF_USEDFPU);
619619
}
620620
}
621621
#else

‎arch/sparc/kernel/traps.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
259259
} else {
260260
fpload(&current->thread.float_regs[0], &current->thread.fsr);
261261
}
262-
current_thread_info()->flags |= _TIF_USEDFPU;
262+
set_thread_flag(TIF_USEDFPU);
263263
#endif
264264
}
265265

@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
290290
#ifndef CONFIG_SMP
291291
if(!fpt) {
292292
#else
293-
if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
293+
if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
294294
#endif
295295
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
296296
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
333333
/* nope, better SIGFPE the offending process... */
334334

335335
#ifdef CONFIG_SMP
336-
task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
336+
clear_tsk_thread_flag(fpt, TIF_USEDFPU);
337337
#endif
338338
if(psr & PSR_PS) {
339339
/* The first fsr store/load we tried trapped,

0 commit comments

Comments
 (0)