* [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-09 3:12 ` Mathieu Desnoyers
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2007-03-09 3:12 UTC (permalink / raw)
To: akpm, mbligh, linux-kernel, wli, sparclinux
Fix sparc TIF_USEDFPU flag atomicity
Non atomic update of TIF can be very dangerous, except at thread structure
creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
Applies on 2.6.20.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -348,7 +348,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_tsk_thread_flag(current, TIF_USEDFPU)) {
#endif
/* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
}
@@ -371,7 +371,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_tsk_thread_flag(current, TIF_USEDFPU)) {
#endif
/* Clean the fpu. */
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_tsk_thread_flag(current, TIF_USEDFPU)) {
#endif
put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
return 1;
}
#ifdef CONFIG_SMP
- if (current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF);
fpsave(¤t->thread.float_regs[0], ¤t->thread.fsr,
¤t->thread.fpqueue[0], ¤t->thread.fpqdepth);
if (regs != NULL) {
regs->psr &= ~(PSR_EF);
- current_thread_info()->flags &= ~(_TIF_USEDFPU);
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
}
}
#else
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 6a70d21..7a7ad05 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
} else {
fpload(¤t->thread.float_regs[0], ¤t->thread.fsr);
}
- current_thread_info()->flags |= _TIF_USEDFPU;
+ set_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
#ifndef CONFIG_SMP
if(!fpt) {
#else
- if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+ if(!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
#endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
/* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP
- task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif
if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped,
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-09 3:12 ` Mathieu Desnoyers
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2007-03-09 3:12 UTC (permalink / raw)
To: akpm, mbligh, linux-kernel, wli, sparclinux
Fix sparc TIF_USEDFPU flag atomicity
Non atomic update of TIF can be very dangerous, except at thread structure
creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
Applies on 2.6.20.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -348,7 +348,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_tsk_thread_flag(current, TIF_USEDFPU)) {
#endif
/* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
}
@@ -371,7 +371,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_tsk_thread_flag(current, TIF_USEDFPU)) {
#endif
/* Clean the fpu. */
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_tsk_thread_flag(current, TIF_USEDFPU)) {
#endif
put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
@@ -609,13 +609,13 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
return 1;
}
#ifdef CONFIG_SMP
- if (current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF);
fpsave(¤t->thread.float_regs[0], ¤t->thread.fsr,
¤t->thread.fpqueue[0], ¤t->thread.fpqdepth);
if (regs != NULL) {
regs->psr &= ~(PSR_EF);
- current_thread_info()->flags &= ~(_TIF_USEDFPU);
+ clear_tsk_thread_flag(current, TIF_USEDFPU);
}
}
#else
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 6a70d21..7a7ad05 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
} else {
fpload(¤t->thread.float_regs[0], ¤t->thread.fsr);
}
- current_thread_info()->flags |= _TIF_USEDFPU;
+ set_tsk_thread_flag(current, TIF_USEDFPU);
#endif
}
@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
#ifndef CONFIG_SMP
if(!fpt) {
#else
- if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+ if(!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
#endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
/* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP
- task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif
if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped,
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-09 3:12 ` Mathieu Desnoyers
@ 2007-03-09 5:25 ` David Miller
-1 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2007-03-09 5:25 UTC (permalink / raw)
To: mathieu.desnoyers; +Cc: akpm, mbligh, linux-kernel, wli, sparclinux
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Date: Thu, 8 Mar 2007 22:12:27 -0500
> Fix sparc TIF_USEDFPU flag atomicity
>
> Non atomic update of TIF can be very dangerous, except at thread structure
> creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
>
> Applies on 2.6.20.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Also applied, thanks a lot.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-09 5:25 ` David Miller
0 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2007-03-09 5:25 UTC (permalink / raw)
To: mathieu.desnoyers; +Cc: akpm, mbligh, linux-kernel, wli, sparclinux
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Date: Thu, 8 Mar 2007 22:12:27 -0500
> Fix sparc TIF_USEDFPU flag atomicity
>
> Non atomic update of TIF can be very dangerous, except at thread structure
> creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
>
> Applies on 2.6.20.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Also applied, thanks a lot.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-09 5:25 ` David Miller
@ 2007-03-09 11:20 ` William Lee Irwin III
-1 siblings, 0 replies; 18+ messages in thread
From: William Lee Irwin III @ 2007-03-09 11:20 UTC (permalink / raw)
To: David Miller; +Cc: mathieu.desnoyers, akpm, mbligh, linux-kernel, sparclinux
On Thu, 8 Mar 2007 22:12:27 -0500 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
>> Fix sparc TIF_USEDFPU flag atomicity
>> Non atomic update of TIF can be very dangerous, except at thread structure
>> creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
>> Applies on 2.6.20.
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
On Thu, Mar 08, 2007 at 09:25:23PM -0800, David Miller wrote:
> Also applied, thanks a lot.
Thanks again for doing just about everything here while I get my act
back together (never mind how preposterously long it's taking).
Acked-by: William Irwin <wli@holomorphy.com>
-- wli
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-09 11:20 ` William Lee Irwin III
0 siblings, 0 replies; 18+ messages in thread
From: William Lee Irwin III @ 2007-03-09 11:20 UTC (permalink / raw)
To: David Miller; +Cc: mathieu.desnoyers, akpm, mbligh, linux-kernel, sparclinux
On Thu, 8 Mar 2007 22:12:27 -0500 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
>> Fix sparc TIF_USEDFPU flag atomicity
>> Non atomic update of TIF can be very dangerous, except at thread structure
>> creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
>> Applies on 2.6.20.
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
On Thu, Mar 08, 2007 at 09:25:23PM -0800, David Miller wrote:
> Also applied, thanks a lot.
Thanks again for doing just about everything here while I get my act
back together (never mind how preposterously long it's taking).
Acked-by: William Irwin <wli@holomorphy.com>
-- wli
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 8:17 ` Mathieu Desnoyers
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2007-03-10 8:17 UTC (permalink / raw)
To: akpm, mbligh, linux-kernel, wli, sparclinux
Fix sparc TIF_USEDFPU flag atomicity
Non atomic update of TIF can be very dangerous, except at thread structure
creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
This fix addresses the issue with *_ti_thread_flag().
Applies on 2.6.20.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -348,7 +348,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
#endif
/* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
}
@@ -371,7 +371,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
#endif
/* Clean the fpu. */
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
#endif
put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
@@ -609,13 +609,14 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
return 1;
}
#ifdef CONFIG_SMP
- if (current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF);
fpsave(¤t->thread.float_regs[0], ¤t->thread.fsr,
¤t->thread.fpqueue[0], ¤t->thread.fpqdepth);
if (regs != NULL) {
regs->psr &= ~(PSR_EF);
- current_thread_info()->flags &= ~(_TIF_USEDFPU);
+ clear_ti_thread_flag(current_thread_info(),
+ TIF_USEDFPU);
}
}
#else
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 6a70d21..8ec8d08 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
} else {
fpload(¤t->thread.float_regs[0], ¤t->thread.fsr);
}
- current_thread_info()->flags |= _TIF_USEDFPU;
+ set_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
#ifndef CONFIG_SMP
if(!fpt) {
#else
- if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+ if(!test_ti_thread_flag(task_thread_info(fpt), TIF_USEDFPU)) {
#endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
/* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP
- task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif
if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped,
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 8:17 ` Mathieu Desnoyers
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2007-03-10 8:17 UTC (permalink / raw)
To: akpm, mbligh, linux-kernel, wli, sparclinux
Fix sparc TIF_USEDFPU flag atomicity
Non atomic update of TIF can be very dangerous, except at thread structure
creation time. Here I standardize the TIF_USEDFPU usage of the sparc arch.
This fix addresses the issue with *_ti_thread_flag().
Applies on 2.6.20.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -348,7 +348,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
#endif
/* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@ void exit_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
}
@@ -371,7 +371,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
#endif
/* Clean the fpu. */
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@ void flush_thread(void)
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
@@ -466,13 +466,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
#endif
put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
@@ -609,13 +609,14 @@ int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs)
return 1;
}
#ifdef CONFIG_SMP
- if (current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF);
fpsave(¤t->thread.float_regs[0], ¤t->thread.fsr,
¤t->thread.fpqueue[0], ¤t->thread.fpqdepth);
if (regs != NULL) {
regs->psr &= ~(PSR_EF);
- current_thread_info()->flags &= ~(_TIF_USEDFPU);
+ clear_ti_thread_flag(current_thread_info(),
+ TIF_USEDFPU);
}
}
#else
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 6a70d21..8ec8d08 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -259,7 +259,7 @@ void do_fpd_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
} else {
fpload(¤t->thread.float_regs[0], ¤t->thread.fsr);
}
- current_thread_info()->flags |= _TIF_USEDFPU;
+ set_ti_thread_flag(current_thread_info(), TIF_USEDFPU);
#endif
}
@@ -290,7 +290,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
#ifndef CONFIG_SMP
if(!fpt) {
#else
- if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+ if(!test_ti_thread_flag(task_thread_info(fpt), TIF_USEDFPU)) {
#endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
/* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP
- task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif
if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped,
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-10 8:17 ` Mathieu Desnoyers
@ 2007-03-10 8:26 ` William Lee Irwin III
-1 siblings, 0 replies; 18+ messages in thread
From: William Lee Irwin III @ 2007-03-10 8:26 UTC (permalink / raw)
To: Mathieu Desnoyers; +Cc: akpm, mbligh, linux-kernel, sparclinux
On Sat, Mar 10, 2007 at 03:17:43AM -0500, Mathieu Desnoyers wrote:
> @@ -348,7 +348,7 @@ void exit_thread(void)
> #ifndef CONFIG_SMP
> if(last_task_used_math = current) {
> #else
> - if(current_thread_info()->flags & _TIF_USEDFPU) {
> + if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
> #endif
> /* Keep process from leaving FPU in a bogon state. */
> put_psr(get_psr() | PSR_EF);
Oh dear. Could we bit a bit more idiomatic here? For instance,
something like:
Index: linux-2.6/arch/sparc/kernel/process.c
=================================--- linux-2.6.orig/arch/sparc/kernel/process.c 2007-03-09 23:24:12.934472032 -0800
+++ linux-2.6/arch/sparc/kernel/process.c 2007-03-09 23:29:26.592346376 -0800
@@ -348,7 +348,7 @@
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
#endif
/* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_thread_flag(TIF_USEDFPU);
#endif
}
}
@@ -371,7 +371,7 @@
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
#endif
/* Clean the fpu. */
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_thread_flag(TIF_USEDFPU);
#endif
}
@@ -466,13 +466,13 @@
#ifndef CONFIG_SMP
if(last_task_used_math = current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
#endif
put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_thread_flag(TIF_USEDFPU);
#endif
}
@@ -609,13 +609,13 @@
return 1;
}
#ifdef CONFIG_SMP
- if (current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF);
fpsave(¤t->thread.float_regs[0], ¤t->thread.fsr,
¤t->thread.fpqueue[0], ¤t->thread.fpqdepth);
if (regs != NULL) {
regs->psr &= ~(PSR_EF);
- current_thread_info()->flags &= ~(_TIF_USEDFPU);
+ clear_thread_flag(TIF_USEDFPU);
}
}
#else
Index: linux-2.6/arch/sparc/kernel/traps.c
=================================--- linux-2.6.orig/arch/sparc/kernel/traps.c 2007-03-09 23:40:33.994379450 -0800
+++ linux-2.6/arch/sparc/kernel/traps.c 2007-03-09 23:44:07.910569839 -0800
@@ -259,7 +259,7 @@
} else {
fpload(¤t->thread.float_regs[0], ¤t->thread.fsr);
}
- current_thread_info()->flags |= _TIF_USEDFPU;
+ set_thread_flag(TIF_USEDFPU);
#endif
}
@@ -290,7 +290,7 @@
#ifndef CONFIG_SMP
if(!fpt) {
#else
- if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+ if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
#endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@
/* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP
- task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif
if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped,
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 8:26 ` William Lee Irwin III
0 siblings, 0 replies; 18+ messages in thread
From: William Lee Irwin III @ 2007-03-10 8:26 UTC (permalink / raw)
To: Mathieu Desnoyers; +Cc: akpm, mbligh, linux-kernel, sparclinux
On Sat, Mar 10, 2007 at 03:17:43AM -0500, Mathieu Desnoyers wrote:
> @@ -348,7 +348,7 @@ void exit_thread(void)
> #ifndef CONFIG_SMP
> if(last_task_used_math == current) {
> #else
> - if(current_thread_info()->flags & _TIF_USEDFPU) {
> + if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
> #endif
> /* Keep process from leaving FPU in a bogon state. */
> put_psr(get_psr() | PSR_EF);
Oh dear. Could we bit a bit more idiomatic here? For instance,
something like:
Index: linux-2.6/arch/sparc/kernel/process.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/process.c 2007-03-09 23:24:12.934472032 -0800
+++ linux-2.6/arch/sparc/kernel/process.c 2007-03-09 23:29:26.592346376 -0800
@@ -348,7 +348,7 @@
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
#endif
/* Keep process from leaving FPU in a bogon state. */
put_psr(get_psr() | PSR_EF);
@@ -357,7 +357,7 @@
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_thread_flag(TIF_USEDFPU);
#endif
}
}
@@ -371,7 +371,7 @@
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
#endif
/* Clean the fpu. */
put_psr(get_psr() | PSR_EF);
@@ -380,7 +380,7 @@
#ifndef CONFIG_SMP
last_task_used_math = NULL;
#else
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_thread_flag(TIF_USEDFPU);
#endif
}
@@ -466,13 +466,13 @@
#ifndef CONFIG_SMP
if(last_task_used_math == current) {
#else
- if(current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
#endif
put_psr(get_psr() | PSR_EF);
fpsave(&p->thread.float_regs[0], &p->thread.fsr,
&p->thread.fpqueue[0], &p->thread.fpqdepth);
#ifdef CONFIG_SMP
- current_thread_info()->flags &= ~_TIF_USEDFPU;
+ clear_thread_flag(TIF_USEDFPU);
#endif
}
@@ -609,13 +609,13 @@
return 1;
}
#ifdef CONFIG_SMP
- if (current_thread_info()->flags & _TIF_USEDFPU) {
+ if (test_thread_flag(TIF_USEDFPU)) {
put_psr(get_psr() | PSR_EF);
fpsave(¤t->thread.float_regs[0], ¤t->thread.fsr,
¤t->thread.fpqueue[0], ¤t->thread.fpqdepth);
if (regs != NULL) {
regs->psr &= ~(PSR_EF);
- current_thread_info()->flags &= ~(_TIF_USEDFPU);
+ clear_thread_flag(TIF_USEDFPU);
}
}
#else
Index: linux-2.6/arch/sparc/kernel/traps.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/traps.c 2007-03-09 23:40:33.994379450 -0800
+++ linux-2.6/arch/sparc/kernel/traps.c 2007-03-09 23:44:07.910569839 -0800
@@ -259,7 +259,7 @@
} else {
fpload(¤t->thread.float_regs[0], ¤t->thread.fsr);
}
- current_thread_info()->flags |= _TIF_USEDFPU;
+ set_thread_flag(TIF_USEDFPU);
#endif
}
@@ -290,7 +290,7 @@
#ifndef CONFIG_SMP
if(!fpt) {
#else
- if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
+ if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
#endif
fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
regs->psr &= ~PSR_EF;
@@ -333,7 +333,7 @@
/* nope, better SIGFPE the offending process... */
#ifdef CONFIG_SMP
- task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
+ clear_tsk_thread_flag(fpt, TIF_USEDFPU);
#endif
if(psr & PSR_PS) {
/* The first fsr store/load we tried trapped,
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-10 8:17 ` Mathieu Desnoyers
@ 2007-03-10 8:28 ` David Miller
-1 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2007-03-10 8:28 UTC (permalink / raw)
To: mathieu.desnoyers; +Cc: akpm, mbligh, linux-kernel, wli, sparclinux
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Date: Sat, 10 Mar 2007 03:17:43 -0500
> Fix sparc TIF_USEDFPU flag atomicity
Also applied, thanks again.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 8:28 ` David Miller
0 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2007-03-10 8:28 UTC (permalink / raw)
To: mathieu.desnoyers; +Cc: akpm, mbligh, linux-kernel, wli, sparclinux
From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Date: Sat, 10 Mar 2007 03:17:43 -0500
> Fix sparc TIF_USEDFPU flag atomicity
Also applied, thanks again.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-10 8:26 ` William Lee Irwin III
@ 2007-03-10 8:29 ` David Miller
-1 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2007-03-10 8:29 UTC (permalink / raw)
To: wli; +Cc: mathieu.desnoyers, akpm, mbligh, linux-kernel, sparclinux
From: William Lee Irwin III <wli@holomorphy.com>
Date: Sat, 10 Mar 2007 00:26:46 -0800
> On Sat, Mar 10, 2007 at 03:17:43AM -0500, Mathieu Desnoyers wrote:
> > @@ -348,7 +348,7 @@ void exit_thread(void)
> > #ifndef CONFIG_SMP
> > if(last_task_used_math = current) {
> > #else
> > - if(current_thread_info()->flags & _TIF_USEDFPU) {
> > + if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
> > #endif
> > /* Keep process from leaving FPU in a bogon state. */
> > put_psr(get_psr() | PSR_EF);
>
> Oh dear. Could we bit a bit more idiomatic here? For instance,
> something like:
Ok I pulled the sparc32 patch back out until there is some
consensus here :)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 8:29 ` David Miller
0 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2007-03-10 8:29 UTC (permalink / raw)
To: wli; +Cc: mathieu.desnoyers, akpm, mbligh, linux-kernel, sparclinux
From: William Lee Irwin III <wli@holomorphy.com>
Date: Sat, 10 Mar 2007 00:26:46 -0800
> On Sat, Mar 10, 2007 at 03:17:43AM -0500, Mathieu Desnoyers wrote:
> > @@ -348,7 +348,7 @@ void exit_thread(void)
> > #ifndef CONFIG_SMP
> > if(last_task_used_math == current) {
> > #else
> > - if(current_thread_info()->flags & _TIF_USEDFPU) {
> > + if(test_ti_thread_flag(current_thread_info(), TIF_USEDFPU)) {
> > #endif
> > /* Keep process from leaving FPU in a bogon state. */
> > put_psr(get_psr() | PSR_EF);
>
> Oh dear. Could we bit a bit more idiomatic here? For instance,
> something like:
Ok I pulled the sparc32 patch back out until there is some
consensus here :)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-10 8:29 ` David Miller
@ 2007-03-10 10:59 ` William Lee Irwin III
-1 siblings, 0 replies; 18+ messages in thread
From: William Lee Irwin III @ 2007-03-10 10:59 UTC (permalink / raw)
To: David Miller; +Cc: mathieu.desnoyers, akpm, mbligh, linux-kernel, sparclinux
On Sat, 10 Mar 2007 00:26:46 -0800, William Lee Irwin III <wli@holomorphy.com> wrote:
>> Oh dear. Could we bit a bit more idiomatic here? For instance,
>> something like:
On Sat, Mar 10, 2007 at 12:29:44AM -0800, David Miller wrote:
> Ok I pulled the sparc32 patch back out until there is some
> consensus here :)
It's just a minor touch-up. If Mathieu is okay with it, I'd rather
leave him as the author and just send along an Acked-by: with it.
I'm not terribly attached to it, either. I just choked on my soda
when I saw set_ti_thread_flag(task_thread_info(fpt), TI_USEDFPU)
etc. go by. (Which reminds me, I really need to figure out how to
consolidate the UP and SMP cases for all this.)
-- wli
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 10:59 ` William Lee Irwin III
0 siblings, 0 replies; 18+ messages in thread
From: William Lee Irwin III @ 2007-03-10 10:59 UTC (permalink / raw)
To: David Miller; +Cc: mathieu.desnoyers, akpm, mbligh, linux-kernel, sparclinux
On Sat, 10 Mar 2007 00:26:46 -0800, William Lee Irwin III <wli@holomorphy.com> wrote:
>> Oh dear. Could we bit a bit more idiomatic here? For instance,
>> something like:
On Sat, Mar 10, 2007 at 12:29:44AM -0800, David Miller wrote:
> Ok I pulled the sparc32 patch back out until there is some
> consensus here :)
It's just a minor touch-up. If Mathieu is okay with it, I'd rather
leave him as the author and just send along an Acked-by: with it.
I'm not terribly attached to it, either. I just choked on my soda
when I saw set_ti_thread_flag(task_thread_info(fpt), TI_USEDFPU)
etc. go by. (Which reminds me, I really need to figure out how to
consolidate the UP and SMP cases for all this.)
-- wli
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
2007-03-10 10:59 ` William Lee Irwin III
@ 2007-03-10 16:31 ` Mathieu Desnoyers
-1 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2007-03-10 16:31 UTC (permalink / raw)
To: William Lee Irwin III
Cc: David Miller, akpm, mbligh, linux-kernel, sparclinux
* William Lee Irwin III (wli@holomorphy.com) wrote:
> On Sat, 10 Mar 2007 00:26:46 -0800, William Lee Irwin III <wli@holomorphy.com> wrote:
> >> Oh dear. Could we bit a bit more idiomatic here? For instance,
> >> something like:
>
> On Sat, Mar 10, 2007 at 12:29:44AM -0800, David Miller wrote:
> > Ok I pulled the sparc32 patch back out until there is some
> > consensus here :)
>
> It's just a minor touch-up. If Mathieu is okay with it, I'd rather
> leave him as the author and just send along an Acked-by: with it.
> I'm not terribly attached to it, either. I just choked on my soda
> when I saw set_ti_thread_flag(task_thread_info(fpt), TI_USEDFPU)
> etc. go by. (Which reminds me, I really need to figure out how to
> consolidate the UP and SMP cases for all this.)
>
>
> -- wli
Hello,
William's implementation is indeed neater than mine. So the consensus
goes to his patch as far as I'm concerned.
Mathieu
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] Fix sparc TIF_USEDFPU flag atomicity
@ 2007-03-10 16:31 ` Mathieu Desnoyers
0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2007-03-10 16:31 UTC (permalink / raw)
To: William Lee Irwin III
Cc: David Miller, akpm, mbligh, linux-kernel, sparclinux
* William Lee Irwin III (wli@holomorphy.com) wrote:
> On Sat, 10 Mar 2007 00:26:46 -0800, William Lee Irwin III <wli@holomorphy.com> wrote:
> >> Oh dear. Could we bit a bit more idiomatic here? For instance,
> >> something like:
>
> On Sat, Mar 10, 2007 at 12:29:44AM -0800, David Miller wrote:
> > Ok I pulled the sparc32 patch back out until there is some
> > consensus here :)
>
> It's just a minor touch-up. If Mathieu is okay with it, I'd rather
> leave him as the author and just send along an Acked-by: with it.
> I'm not terribly attached to it, either. I just choked on my soda
> when I saw set_ti_thread_flag(task_thread_info(fpt), TI_USEDFPU)
> etc. go by. (Which reminds me, I really need to figure out how to
> consolidate the UP and SMP cases for all this.)
>
>
> -- wli
Hello,
William's implementation is indeed neater than mine. So the consensus
goes to his patch as far as I'm concerned.
Mathieu
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2007-03-10 16:36 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 3:12 [PATCH] Fix sparc TIF_USEDFPU flag atomicity Mathieu Desnoyers
2007-03-09 3:12 ` Mathieu Desnoyers
2007-03-09 5:25 ` David Miller
2007-03-09 5:25 ` David Miller
2007-03-09 11:20 ` William Lee Irwin III
2007-03-09 11:20 ` William Lee Irwin III
2007-03-10 8:17 ` Mathieu Desnoyers
2007-03-10 8:17 ` Mathieu Desnoyers
2007-03-10 8:26 ` William Lee Irwin III
2007-03-10 8:26 ` William Lee Irwin III
2007-03-10 8:29 ` David Miller
2007-03-10 8:29 ` David Miller
2007-03-10 10:59 ` William Lee Irwin III
2007-03-10 10:59 ` William Lee Irwin III
2007-03-10 16:31 ` Mathieu Desnoyers
2007-03-10 16:31 ` Mathieu Desnoyers
2007-03-10 8:28 ` David Miller
2007-03-10 8:28 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.