* [PATCH 2.5] r4k_switch task_struct/thread_info fixes
@ 2003-02-03 22:21 Vivien Chappelier
2003-02-04 12:54 ` Ralf Baechle
2003-02-07 0:36 ` Jun Sun
0 siblings, 2 replies; 5+ messages in thread
From: Vivien Chappelier @ 2003-02-03 22:21 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Jun Sun, linux-mips
Hi,
This patch fixes an incorrect use of THREAD_FLAGS instead of
TI_FLAGS when clearing the TIF_USEDFPU flag of the current thread info,
and an incorrect assumption when using ST_OFF, that the stack is shared
with task_struct, whereas it is shared with thread_info in 2.5.
Vivien.
Index: arch/mips64/kernel/r4k_switch.S
===================================================================
RCS file: /home/cvs/linux/arch/mips64/kernel/r4k_switch.S,v
retrieving revision 1.22
diff -u -r1.22 r4k_switch.S
--- arch/mips64/kernel/r4k_switch.S 5 Nov 2002 19:51:47 -0000 1.22
+++ arch/mips64/kernel/r4k_switch.S 3 Feb 2003 22:05:26 -0000
@@ -24,6 +24,10 @@
.set mips3
+/*
+ * Offset to the current process status flags, the first 32 bytes of the
+ * stack are not used.
+ */
#define ST_OFF (KERNEL_STACK_SIZE - 32 - PT_SIZE + PT_STATUS)
/*
@@ -58,15 +62,15 @@
nor t1, zero, t1
and t0, t0, t1
- sd t0, TASK_FLAGS(t3)
+ sd t0, TI_FLAGS(t3)
/*
* clear saved user stack CU1 bit
*/
- ld t0, ST_OFF(a0)
+ ld t0, ST_OFF(t3)
li t1, ~ST0_CU1
and t0, t0, t1
- sd t0, ST_OFF(a0)
+ sd t0, ST_OFF(t3)
sll t2, t0, 5
Index: arch/mips/kernel/r4k_switch.S
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/r4k_switch.S,v
retrieving revision 1.29
diff -u -r1.29 r4k_switch.S
--- arch/mips/kernel/r4k_switch.S 5 Nov 2002 19:51:47 -0000 1.29
+++ arch/mips/kernel/r4k_switch.S 3 Feb 2003 22:06:17 -0000
@@ -67,10 +67,10 @@
/*
* clear saved user stack CU1 bit
*/
- lw t0, ST_OFF(a0)
+ lw t0, ST_OFF(t3)
li t1, ~ST0_CU1
and t0, t0, t1
- sw t0, ST_OFF(a0)
+ sw t0, ST_OFF(t3)
FPU_SAVE_DOUBLE(a0, t0) # clobbers t0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.5] r4k_switch task_struct/thread_info fixes
2003-02-03 22:21 [PATCH 2.5] r4k_switch task_struct/thread_info fixes Vivien Chappelier
@ 2003-02-04 12:54 ` Ralf Baechle
2003-02-07 0:36 ` Jun Sun
1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2003-02-04 12:54 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Jun Sun, linux-mips
On Mon, Feb 03, 2003 at 11:21:50PM +0100, Vivien Chappelier wrote:
> This patch fixes an incorrect use of THREAD_FLAGS instead of
> TI_FLAGS when clearing the TIF_USEDFPU flag of the current thread info,
> and an incorrect assumption when using ST_OFF, that the stack is shared
> with task_struct, whereas it is shared with thread_info in 2.5.
Ok. You missed r2300_switch.S though :)
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.5] r4k_switch task_struct/thread_info fixes
2003-02-03 22:21 [PATCH 2.5] r4k_switch task_struct/thread_info fixes Vivien Chappelier
2003-02-04 12:54 ` Ralf Baechle
@ 2003-02-07 0:36 ` Jun Sun
2003-02-07 9:29 ` Vivien Chappelier
1 sibling, 1 reply; 5+ messages in thread
From: Jun Sun @ 2003-02-07 0:36 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Ralf Baechle, linux-mips, jsun
Actually the following hunks are not right. ST_OFF
should be applied against the task_struct, which is a0,
not thread_info (t3). Try to back off the change and see if things
are ok.
Also see my next email before you rush into trying :-)
Jun
On Mon, Feb 03, 2003 at 11:21:50PM +0100, Vivien Chappelier wrote:
<snip>
> /*
> * clear saved user stack CU1 bit
> */
> - ld t0, ST_OFF(a0)
> + ld t0, ST_OFF(t3)
> li t1, ~ST0_CU1
> and t0, t0, t1
> - sd t0, ST_OFF(a0)
> + sd t0, ST_OFF(t3)
>
>
> sll t2, t0, 5
> Index: arch/mips/kernel/r4k_switch.S
> ===================================================================
> RCS file: /home/cvs/linux/arch/mips/kernel/r4k_switch.S,v
> retrieving revision 1.29
> diff -u -r1.29 r4k_switch.S
> --- arch/mips/kernel/r4k_switch.S 5 Nov 2002 19:51:47 -0000 1.29
> +++ arch/mips/kernel/r4k_switch.S 3 Feb 2003 22:06:17 -0000
> @@ -67,10 +67,10 @@
> /*
> * clear saved user stack CU1 bit
> */
> - lw t0, ST_OFF(a0)
> + lw t0, ST_OFF(t3)
> li t1, ~ST0_CU1
> and t0, t0, t1
> - sw t0, ST_OFF(a0)
> + sw t0, ST_OFF(t3)
>
> FPU_SAVE_DOUBLE(a0, t0) # clobbers t0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.5] r4k_switch task_struct/thread_info fixes
2003-02-07 0:36 ` Jun Sun
@ 2003-02-07 9:29 ` Vivien Chappelier
2003-02-07 18:40 ` Jun Sun
0 siblings, 1 reply; 5+ messages in thread
From: Vivien Chappelier @ 2003-02-07 9:29 UTC (permalink / raw)
To: Jun Sun; +Cc: Ralf Baechle, linux-mips
On Thu, 6 Feb 2003, Jun Sun wrote:
> Actually the following hunks are not right. ST_OFF
> should be applied against the task_struct, which is a0,
> not thread_info (t3).
In 2.4 yes, not in 2.5.
include/linux/sched.h:469
> union thread_union {
> struct thread_info thread_info;
> unsigned long stack[INIT_THREAD_SIZE/sizeof(long)];
> };
That means the top of the stack is actually at (task->thread_info +
KERNEL_STACK_SIZE) in 2.5. See for example arch/mips64/kernel/ptrace.c:107
> Also see my next email before you rush into trying :-)
Ok, I'll look at it later.
Vivien.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2.5] r4k_switch task_struct/thread_info fixes
2003-02-07 9:29 ` Vivien Chappelier
@ 2003-02-07 18:40 ` Jun Sun
0 siblings, 0 replies; 5+ messages in thread
From: Jun Sun @ 2003-02-07 18:40 UTC (permalink / raw)
To: Vivien Chappelier; +Cc: Ralf Baechle, linux-mips, jsun
On Fri, Feb 07, 2003 at 10:29:16AM +0100, Vivien Chappelier wrote:
> On Thu, 6 Feb 2003, Jun Sun wrote:
>
> > Actually the following hunks are not right. ST_OFF
> > should be applied against the task_struct, which is a0,
> > not thread_info (t3).
>
> In 2.4 yes, not in 2.5.
>
You are right. I got misled. I thought task struct has 2 page
size and thread_info is allocated from slab. It should be reverse.
> include/linux/sched.h:469
> > union thread_union {
> > struct thread_info thread_info;
> > unsigned long stack[INIT_THREAD_SIZE/sizeof(long)];
> > };
>
> That means the top of the stack is actually at (task->thread_info +
> KERNEL_STACK_SIZE) in 2.5. See for example arch/mips64/kernel/ptrace.c:107
>
> > Also see my next email before you rush into trying :-)
>
> Ok, I'll look at it later.
>
It turns I made a rather stupid comment there as well. See it there. :-)
Jun
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-07 18:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-03 22:21 [PATCH 2.5] r4k_switch task_struct/thread_info fixes Vivien Chappelier
2003-02-04 12:54 ` Ralf Baechle
2003-02-07 0:36 ` Jun Sun
2003-02-07 9:29 ` Vivien Chappelier
2003-02-07 18:40 ` Jun Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox