linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER
@ 2012-05-24  0:34 Tim Bird
  2012-05-24 14:19 ` Ben Dooks
  2012-06-21 17:42 ` Tim Bird
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Bird @ 2012-05-24  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

This reduces the number of magic values in the code, as well as
makes it easier to experiment with larger or smaller stack sizes.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
PATCH FOLLOWS
---
 arch/arm/include/asm/thread_info.h |    2 +-
 arch/arm/kernel/entry-header.S     |    8 ++++----
 arch/arm/mm/proc-macros.S          |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 0f04d84..5172c36 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -16,7 +16,7 @@
 #include <asm/fpstate.h>

 #define THREAD_SIZE_ORDER	1
-#define THREAD_SIZE		8192
+#define THREAD_SIZE		(4096 << THREAD_SIZE_ORDER)
 #define THREAD_START_SP		(THREAD_SIZE - 8)

 #ifndef __ASSEMBLY__
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 9a8531e..f94216b 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -109,8 +109,8 @@
 	.endm

 	.macro	get_thread_info, rd
-	mov	\rd, sp, lsr #13
-	mov	\rd, \rd, lsl #13
+	mov	\rd, sp, lsr #12 + THREAD_SIZE_ORDER
+	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
 	.endm

 	@
@@ -150,8 +150,8 @@

 	.macro	get_thread_info, rd
 	mov	\rd, sp
-	lsr	\rd, \rd, #13
-	mov	\rd, \rd, lsl #13
+	lsr	\rd, \rd, #12 + THREAD_SIZE_ORDER
+	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
 	.endm

 	@
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 2d8ff3a..7006c88 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -30,8 +30,8 @@
  * act_mm - get current->active_mm
  */
 	.macro	act_mm, rd
-	bic	\rd, sp, #8128
-	bic	\rd, \rd, #63
+	mov	\rd, sp, lsr #12 + THREAD_SIZE_ORDER
+	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
 	ldr	\rd, [\rd, #TI_TASK]
 	ldr	\rd, [\rd, #TSK_ACTIVE_MM]
 	.endm
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER
  2012-05-24  0:34 [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER Tim Bird
@ 2012-05-24 14:19 ` Ben Dooks
  2012-06-21 17:42 ` Tim Bird
  1 sibling, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2012-05-24 14:19 UTC (permalink / raw)
  To: linux-arm-kernel

On 24/05/12 01:34, Tim Bird wrote:
> This reduces the number of magic values in the code, as well as
> makes it easier to experiment with larger or smaller stack sizes.
>
> Signed-off-by: Tim Bird<tim.bird@am.sony.com>

Just ran my eyes over it, looks fine.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER
  2012-05-24  0:34 [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER Tim Bird
  2012-05-24 14:19 ` Ben Dooks
@ 2012-06-21 17:42 ` Tim Bird
  2012-06-22 10:20   ` Will Deacon
  1 sibling, 1 reply; 4+ messages in thread
From: Tim Bird @ 2012-06-21 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

Any response to the following, which I submitted about
a month ago?  May I submit it to the ARM patch-queue?
Note that Ben Dooks took a quick look at it, but I
haven't gotten an official ACK-ed by from anyone.

It's rather trival, has no performance impact, and
makes the code more flexible IMHO.   I realize it's
not the most important issue in the world, but it
will make my life easier.

[original patch follows]

This reduces the number of magic values in the code, as well as
makes it easier to experiment with larger or smaller stack sizes.

Signed-off-by: Tim Bird <tim.bird@am.sony.com>
PATCH FOLLOWS
---
 arch/arm/include/asm/thread_info.h |    2 +-
 arch/arm/kernel/entry-header.S     |    8 ++++----
 arch/arm/mm/proc-macros.S          |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 0f04d84..5172c36 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -16,7 +16,7 @@
 #include <asm/fpstate.h>

 #define THREAD_SIZE_ORDER	1
-#define THREAD_SIZE		8192
+#define THREAD_SIZE		(4096 << THREAD_SIZE_ORDER)
 #define THREAD_START_SP		(THREAD_SIZE - 8)

 #ifndef __ASSEMBLY__
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 9a8531e..f94216b 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -109,8 +109,8 @@
 	.endm

 	.macro	get_thread_info, rd
-	mov	\rd, sp, lsr #13
-	mov	\rd, \rd, lsl #13
+	mov	\rd, sp, lsr #12 + THREAD_SIZE_ORDER
+	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
 	.endm

 	@
@@ -150,8 +150,8 @@

 	.macro	get_thread_info, rd
 	mov	\rd, sp
-	lsr	\rd, \rd, #13
-	mov	\rd, \rd, lsl #13
+	lsr	\rd, \rd, #12 + THREAD_SIZE_ORDER
+	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
 	.endm

 	@
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index 2d8ff3a..7006c88 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -30,8 +30,8 @@
  * act_mm - get current->active_mm
  */
 	.macro	act_mm, rd
-	bic	\rd, sp, #8128
-	bic	\rd, \rd, #63
+	mov	\rd, sp, lsr #12 + THREAD_SIZE_ORDER
+	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
 	ldr	\rd, [\rd, #TI_TASK]
 	ldr	\rd, [\rd, #TSK_ACTIVE_MM]
 	.endm
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER
  2012-06-21 17:42 ` Tim Bird
@ 2012-06-22 10:20   ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2012-06-22 10:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tim,

On Thu, Jun 21, 2012 at 06:42:17PM +0100, Tim Bird wrote:
> Any response to the following, which I submitted about
> a month ago?  May I submit it to the ARM patch-queue?
> Note that Ben Dooks took a quick look at it, but I
> haven't gotten an official ACK-ed by from anyone.

[...]

> diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
> index 0f04d84..5172c36 100644
> --- a/arch/arm/include/asm/thread_info.h
> +++ b/arch/arm/include/asm/thread_info.h
> @@ -16,7 +16,7 @@
>  #include <asm/fpstate.h>
> 
>  #define THREAD_SIZE_ORDER	1
> -#define THREAD_SIZE		8192
> +#define THREAD_SIZE		(4096 << THREAD_SIZE_ORDER)
>  #define THREAD_START_SP		(THREAD_SIZE - 8)
> 
>  #ifndef __ASSEMBLY__
> diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
> index 9a8531e..f94216b 100644
> --- a/arch/arm/kernel/entry-header.S
> +++ b/arch/arm/kernel/entry-header.S
> @@ -109,8 +109,8 @@
>  	.endm
> 
>  	.macro	get_thread_info, rd
> -	mov	\rd, sp, lsr #13
> -	mov	\rd, \rd, lsl #13
> +	mov	\rd, sp, lsr #12 + THREAD_SIZE_ORDER
> +	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
>  	.endm

Maybe use PAGE_SHIFT instead of hardcoding the 12?

>  	@
> @@ -150,8 +150,8 @@
> 
>  	.macro	get_thread_info, rd
>  	mov	\rd, sp
> -	lsr	\rd, \rd, #13
> -	mov	\rd, \rd, lsl #13
> +	lsr	\rd, \rd, #12 + THREAD_SIZE_ORDER
> +	mov	\rd, \rd, lsl #12 + THREAD_SIZE_ORDER
>  	.endm

I appreciate you've followed the same style as before but while we're here
maybe you could rewrite the lsr as a mov for consistency?

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-22 10:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24  0:34 [PATCH] Consolidate stack size information into THREAD_SIZE_ORDER Tim Bird
2012-05-24 14:19 ` Ben Dooks
2012-06-21 17:42 ` Tim Bird
2012-06-22 10:20   ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).