* [PATCH][RESENT] remove hardcoded offsets from ppc asm
@ 2004-08-07 15:18 Vincent Hanquez
2004-08-07 23:32 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Hanquez @ 2004-08-07 15:18 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, lkml; +Cc: Andrew Morton
Hi LKML,
This patch removes hardcoded offsets from ppc asm.
It generate offsets for thread_info structure instead of hardcoding them.
Please apply or comments,
Signed-off-by: Vincent Hanquez <tab@snarc.org>
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/asm-offsets.c linux-2.6.8-rc3/arch/ppc/kernel/asm-offsets.c
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/asm-offsets.c 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/asm-offsets.c 2004-08-07 16:26:06.000000000 +0200
@@ -129,6 +129,13 @@
DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+ DEFINE(TI_task, offsetof(struct thread_info, task));
+ DEFINE(TI_exec_domain, offsetof(struct thread_info, exec_domain));
+ DEFINE(TI_flags, offsetof(struct thread_info, flags));
+ DEFINE(TI_local_flags, offsetof(struct thread_info, local_flags));
+ DEFINE(TI_cpu, offsetof(struct thread_info, cpu));
+ DEFINE(TI_preempt_count, offsetof(struct thread_info, preempt_count));
+
DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
return 0;
}
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/entry.S linux-2.6.8-rc3/arch/ppc/kernel/entry.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/entry.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/entry.S 2004-08-07 16:26:06.000000000 +0200
@@ -199,10 +199,10 @@
bl do_show_syscall
#endif /* SHOW_SYSCALLS */
rlwinm r10,r1,0,0,18 /* current_thread_info() */
- lwz r11,TI_LOCAL_FLAGS(r10)
+ lwz r11,TI_local_flags(r10)
rlwinm r11,r11,0,~_TIFL_FORCE_NOERROR
- stw r11,TI_LOCAL_FLAGS(r10)
- lwz r11,TI_FLAGS(r10)
+ stw r11,TI_local_flags(r10)
+ lwz r11,TI_flags(r10)
andi. r11,r11,_TIF_SYSCALL_TRACE
bne- syscall_dotrace
syscall_dotrace_cont:
@@ -225,7 +225,7 @@
cmpl 0,r3,r11
rlwinm r12,r1,0,0,18 /* current_thread_info() */
blt+ 30f
- lwz r11,TI_LOCAL_FLAGS(r12)
+ lwz r11,TI_local_flags(r12)
andi. r11,r11,_TIFL_FORCE_NOERROR
bne 30f
neg r3,r3
@@ -237,7 +237,7 @@
30: LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
SYNC
MTMSRD(r10)
- lwz r9,TI_FLAGS(r12)
+ lwz r9,TI_flags(r12)
andi. r0,r9,(_TIF_SYSCALL_TRACE|_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne- syscall_exit_work
syscall_exit_cont:
@@ -311,7 +311,7 @@
SYNC
MTMSRD(r10) /* disable interrupts again */
rlwinm r12,r1,0,0,18 /* current_thread_info() */
- lwz r9,TI_FLAGS(r12)
+ lwz r9,TI_flags(r12)
5:
andi. r0,r9,_TIF_NEED_RESCHED
bne 1f
@@ -567,7 +567,7 @@
sigreturn_exit:
subi r1,r3,STACK_FRAME_OVERHEAD
rlwinm r12,r1,0,0,18 /* current_thread_info() */
- lwz r9,TI_FLAGS(r12)
+ lwz r9,TI_flags(r12)
andi. r0,r9,_TIF_SYSCALL_TRACE
bnel- do_syscall_trace
/* fall through */
@@ -593,7 +593,7 @@
user_exc_return: /* r10 contains MSR_KERNEL here */
/* Check current_thread_info()->flags */
rlwinm r9,r1,0,0,18
- lwz r9,TI_FLAGS(r9)
+ lwz r9,TI_flags(r9)
andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne do_work
@@ -612,16 +612,16 @@
resume_kernel:
/* check current_thread_info->preempt_count */
rlwinm r9,r1,0,0,18
- lwz r0,TI_PREEMPT(r9)
+ lwz r0,TI_preempt_count(r9)
cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
bne restore
- lwz r0,TI_FLAGS(r9)
+ lwz r0,TI_flags(r9)
andi. r0,r0,_TIF_NEED_RESCHED
beq+ restore
andi. r0,r3,MSR_EE /* interrupts off? */
beq restore /* don't schedule if so */
1: lis r0,PREEMPT_ACTIVE@h
- stw r0,TI_PREEMPT(r9)
+ stw r0,TI_preempt_count(r9)
ori r10,r10,MSR_EE
SYNC
MTMSRD(r10) /* hard-enable interrupts */
@@ -631,8 +631,8 @@
MTMSRD(r10) /* disable interrupts */
rlwinm r9,r1,0,0,18
li r0,0
- stw r0,TI_PREEMPT(r9)
- lwz r3,TI_FLAGS(r9)
+ stw r0,TI_preempt_count(r9)
+ lwz r3,TI_flags(r9)
andi. r0,r3,_TIF_NEED_RESCHED
bne- 1b
#else
@@ -913,7 +913,7 @@
SYNC
MTMSRD(r10) /* disable interrupts */
rlwinm r9,r1,0,0,18
- lwz r9,TI_FLAGS(r9)
+ lwz r9,TI_flags(r9)
andi. r0,r9,_TIF_NEED_RESCHED
bne- do_resched
andi. r0,r9,_TIF_SIGPENDING
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/head.S linux-2.6.8-rc3/arch/ppc/kernel/head.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/head.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/head.S 2004-08-07 16:26:06.000000000 +0200
@@ -1240,7 +1240,7 @@
tophys(r1,r1)
lwz r1,secondary_ti@l(r1)
tophys(r2,r1)
- lwz r2,TI_TASK(r2)
+ lwz r2,TI_task(r2)
/* stack */
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_6xx.S linux-2.6.8-rc3/arch/ppc/kernel/idle_6xx.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_6xx.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/idle_6xx.S 2004-08-07 16:26:06.000000000 +0200
@@ -94,7 +94,7 @@
/* Check current_thread_info()->flags */
rlwinm r4,r1,0,0,18
- lwz r4,TI_FLAGS(r4)
+ lwz r4,TI_flags(r4)
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
mtmsr r7 /* out of line this ? */
@@ -191,7 +191,7 @@
rlwinm r9,r1,0,0,18
tophys(r9,r9)
- lwz r11,TI_CPU(r9)
+ lwz r11,TI_cpu(r9)
slwi r11,r11,2
/* Todo make sure all these are in the same page
* and load r22 (@ha part + CPU offset) only once
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_power4.S linux-2.6.8-rc3/arch/ppc/kernel/idle_power4.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/idle_power4.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/idle_power4.S 2004-08-07 16:26:06.000000000 +0200
@@ -66,7 +66,7 @@
/* Check current_thread_info()->flags */
rlwinm r4,r1,0,0,18
- lwz r4,TI_FLAGS(r4)
+ lwz r4,TI_flags(r4)
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
mtmsr r7 /* out of line this ? */
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/misc.S linux-2.6.8-rc3/arch/ppc/kernel/misc.S
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/misc.S 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/misc.S 2004-08-07 16:26:06.000000000 +0200
@@ -233,7 +233,7 @@
/* Store new HID1 image */
rlwinm r6,r1,0,0,18
- lwz r6,TI_CPU(r6)
+ lwz r6,TI_cpu(r6)
slwi r6,r6,2
addis r6,r6,nap_save_hid1@ha
stw r4,nap_save_hid1@l(r6)
@@ -457,7 +457,7 @@
#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
#if defined(CONFIG_SMP)
rlwinm r8,r1,0,0,18
- lwz r8,TI_CPU(r8)
+ lwz r8,TI_cpu(r8)
oris r8,r8,10
mfmsr r10
SYNC
@@ -538,7 +538,7 @@
#else /* !(CONFIG_40x || CONFIG_44x || CONFIG_FSL_BOOKE) */
#if defined(CONFIG_SMP)
rlwinm r8,r1,0,0,18
- lwz r8,TI_CPU(r8)
+ lwz r8,TI_cpu(r8)
oris r8,r8,11
mfmsr r10
SYNC
diff -Naur linux-2.6.8-rc3.orig/include/asm-ppc/thread_info.h linux-2.6.8-rc3/include/asm-ppc/thread_info.h
--- linux-2.6.8-rc3.orig/include/asm-ppc/thread_info.h 2004-08-07 16:20:00.000000000 +0200
+++ linux-2.6.8-rc3/include/asm-ppc/thread_info.h 2004-08-07 16:26:06.000000000 +0200
@@ -65,16 +65,6 @@
*/
#define THREAD_SIZE 8192 /* 2 pages */
-/*
- * Offsets in thread_info structure, used in assembly code
- */
-#define TI_TASK 0
-#define TI_EXECDOMAIN 4
-#define TI_FLAGS 8
-#define TI_LOCAL_FLAGS 12
-#define TI_CPU 16
-#define TI_PREEMPT 20
-
#define PREEMPT_ACTIVE 0x4000000
/*
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESENT] remove hardcoded offsets from ppc asm
2004-08-07 15:18 [PATCH][RESENT] remove hardcoded offsets from ppc asm Vincent Hanquez
@ 2004-08-07 23:32 ` Benjamin Herrenschmidt
2004-08-08 10:25 ` Vincent Hanquez
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2004-08-07 23:32 UTC (permalink / raw)
To: Vincent Hanquez; +Cc: Paul Mackerras, lkml, Andrew Morton
On Sun, 2004-08-08 at 01:18, Vincent Hanquez wrote:
> Hi LKML,
>
> This patch removes hardcoded offsets from ppc asm.
> It generate offsets for thread_info structure instead of hardcoding them.
>
> Please apply or comments,
>
> Signed-off-by: Vincent Hanquez <tab@snarc.org>
I have nothing against the idea, but why the hell did you change the
constant names, turning them partially to lowercase ? They are just
fine beeing uppercase, this is more consistent, and that would
reduce the size of your patch signficantly.
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESENT] remove hardcoded offsets from ppc asm
2004-08-07 23:32 ` Benjamin Herrenschmidt
@ 2004-08-08 10:25 ` Vincent Hanquez
2004-08-08 10:25 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Hanquez @ 2004-08-08 10:25 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: lkml
On Sun, Aug 08, 2004 at 09:32:12AM +1000, Benjamin Herrenschmidt wrote:
> On Sun, 2004-08-08 at 01:18, Vincent Hanquez wrote:
> > Hi LKML,
> >
> > This patch removes hardcoded offsets from ppc asm.
> > It generate offsets for thread_info structure instead of hardcoding them.
> >
> > Please apply or comments,
> >
> > Signed-off-by: Vincent Hanquez <tab@snarc.org>
>
> I have nothing against the idea, but why the hell did you change the
> constant names, turning them partially to lowercase ? They are just
> fine beeing uppercase, this is more consistent, and that would
> reduce the size of your patch signficantly.
Hi Benjamin, it seems to be the 'convention'. I did the same comment
some time ago to Brian Gerst with his patch for i386.
http://marc.theaimsgroup.com/?l=linux-kernel&m=108454158825656&w=2
But if you prefer a smaller patch, without changing the constant
name, I can do that too.
Sorry about the first set of patch, I didn't see your reply. I just saw
it today on the archive.
--
Tab
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESENT] remove hardcoded offsets from ppc asm
2004-08-08 10:25 ` Vincent Hanquez
@ 2004-08-08 10:25 ` Benjamin Herrenschmidt
2004-08-08 10:52 ` Vincent Hanquez
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2004-08-08 10:25 UTC (permalink / raw)
To: Vincent Hanquez; +Cc: lkml
On Sun, 2004-08-08 at 20:25, Vincent Hanquez wrote:
> Hi Benjamin, it seems to be the 'convention'. I did the same comment
> some time ago to Brian Gerst with his patch for i386.
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=108454158825656&w=2
>
> But if you prefer a smaller patch, without changing the constant
> name, I can do that too.
I don't know about this "convention", we certainly don't apply it
on ppc, I'd suggest doing the simpler patch instead.
Ben.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RESENT] remove hardcoded offsets from ppc asm
2004-08-08 10:25 ` Benjamin Herrenschmidt
@ 2004-08-08 10:52 ` Vincent Hanquez
0 siblings, 0 replies; 5+ messages in thread
From: Vincent Hanquez @ 2004-08-08 10:52 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: lkml
On Sun, Aug 08, 2004 at 08:25:42PM +1000, Benjamin Herrenschmidt wrote:
> On Sun, 2004-08-08 at 20:25, Vincent Hanquez wrote:
>
> > Hi Benjamin, it seems to be the 'convention'. I did the same comment
> > some time ago to Brian Gerst with his patch for i386.
> >
> > http://marc.theaimsgroup.com/?l=linux-kernel&m=108454158825656&w=2
> >
> > But if you prefer a smaller patch, without changing the constant
> > name, I can do that too.
>
> I don't know about this "convention", we certainly don't apply it
> on ppc, I'd suggest doing the simpler patch instead.
ok thanks, here it is:
Signed-off-by: Vincent Hanquez <tab@snarc.org>
diff -Naur linux-2.6.8-rc3.orig/arch/ppc/kernel/asm-offsets.c linux-2.6.8-rc3/arch/ppc/kernel/asm-offsets.c
--- linux-2.6.8-rc3.orig/arch/ppc/kernel/asm-offsets.c 2004-08-07 16:19:55.000000000 +0200
+++ linux-2.6.8-rc3/arch/ppc/kernel/asm-offsets.c 2004-08-07 16:26:06.000000000 +0200
@@ -129,6 +129,13 @@
DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+ DEFINE(TI_TASK, offsetof(struct thread_info, task));
+ DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
+ DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
+ DEFINE(TI_LOCAL_FLAGS, offsetof(struct thread_info, local_flags));
+ DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
+ DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
+
DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);
return 0;
}
diff -Naur linux-2.6.8-rc3.orig/include/asm-ppc/thread_info.h linux-2.6.8-rc3/include/asm-ppc/thread_info.h
--- linux-2.6.8-rc3.orig/include/asm-ppc/thread_info.h 2004-08-07 16:20:00.000000000 +0200
+++ linux-2.6.8-rc3/include/asm-ppc/thread_info.h 2004-08-07 16:26:06.000000000 +0200
@@ -65,16 +65,6 @@
*/
#define THREAD_SIZE 8192 /* 2 pages */
-/*
- * Offsets in thread_info structure, used in assembly code
- */
-#define TI_TASK 0
-#define TI_EXECDOMAIN 4
-#define TI_FLAGS 8
-#define TI_LOCAL_FLAGS 12
-#define TI_CPU 16
-#define TI_PREEMPT 20
-
#define PREEMPT_ACTIVE 0x4000000
/*
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-08-08 10:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-07 15:18 [PATCH][RESENT] remove hardcoded offsets from ppc asm Vincent Hanquez
2004-08-07 23:32 ` Benjamin Herrenschmidt
2004-08-08 10:25 ` Vincent Hanquez
2004-08-08 10:25 ` Benjamin Herrenschmidt
2004-08-08 10:52 ` Vincent Hanquez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox