Skip to contentSkip to conversation

Skip unnecessary pte makeup when clearing it.

PATCH New bill4carson at gmail.com 3 participants 5 messages Jan 18, 2012 – Jan 19, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Skip unnecessary pte makeup when clearing it.

From: Bill Carson <[email protected]>

If we are only about to clear a hardware pte entry, then pte makeup code is unnecessary for cpu_v7_set_pte_ext and armv6_set_pte_ext, so just skip it.

---
 arch/arm/mm/proc-macros.S    |   10 +++++-----
 arch/arm/mm/proc-v7-2level.S |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mm/proc-macros.S +5 -5
index 2d8ff3a..11288b3 100644
@@ -138,6 +138,10 @@
 	.macro	armv6_set_pte_ext pfx
 	str	r1, [r0], #2048			@ linux version
 
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	moveq	set_pte
 	bic	r3, r1, #0x000003fc
 	bic	r3, r3, #PTE_TYPE_MASK
 	orr	r3, r3, r2
@@ -163,11 +167,7 @@
 	orrne	r3, r3, #PTE_EXT_XN
 
 	orr	r3, r3, r2
-
-	tst	r1, #L_PTE_YOUNG
-	tstne	r1, #L_PTE_PRESENT
-	moveq	r3, #0
-
+set_pte:
 	str	r3, [r0]
 	mcr	p15, 0, r0, c7, c10, 1		@ flush_pte
 	.endm
arch/arm/mm/proc-v7-2level.S +5 -5
index 3a4b3e7..3e17ec2 100644
@@ -76,6 +76,10 @@ ENTRY(cpu_v7_set_pte_ext)
 #ifdef CONFIG_MMU
 	str	r1, [r0]			@ linux version
 
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	beq		set_pte
 	bic	r3, r1, #0x000003f0
 	bic	r3, r3, #PTE_TYPE_MASK
 	orr	r3, r3, r2
@@ -98,11 +102,7 @@ ENTRY(cpu_v7_set_pte_ext)
 
 	tst	r1, #L_PTE_XN
 	orrne	r3, r3, #PTE_EXT_XN
-
-	tst	r1, #L_PTE_YOUNG
-	tstne	r1, #L_PTE_PRESENT
-	moveq	r3, #0
-
+set_pte:
  ARM(	str	r3, [r0, #2048]! )
  THUMB(	add	r0, r0, #2048 )
  THUMB(	str	r3, [r0] )
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 Skip unnecessary pte makeup when clearing it.

Quoted 16 lines · On Wed, Jan 18, 2012 at 05:52:25PM +0800, bill4carson at gmail.com wrote:

From: Bill Carson <[email protected]>

If we are only about to clear a hardware pte entry, then pte makeup code is unnecessary for cpu_v7_set_pte_ext and armv6_set_pte_ext, so just skip it.

---
 arch/arm/mm/proc-macros.S    |   10 +++++-----
 arch/arm/mm/proc-v7-2level.S |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mm/proc-macros.S +0 -0
index 2d8ff3a..11288b3 100644

arch/arm/mm/proc-macros.S line 147

Quoted 10 lines
arch/arm/mm/proc-macros.S +4 -0
@@ -138,6 +138,10 @@
 	.macro	armv6_set_pte_ext pfx
 	str	r1, [r0], #2048			@ linux version
 
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	moveq	set_pte
 	bic	r3, r1, #0x000003fc
 	bic	r3, r3, #PTE_TYPE_MASK
 	orr	r3, r3, r2

I guess you want

beq set_pte

instead of

moveq set_pte

here?!

Additionally this doesn't seem to be able to be compiled to thumb. I don't know if it must be though.

arch/arm/mm/proc-macros.S line 170

Quoted 10 lines
arch/arm/mm/proc-macros.S +1 -5
@@ -163,11 +167,7 @@
 	orrne	r3, r3, #PTE_EXT_XN
 
 	orr	r3, r3, r2
-
-	tst	r1, #L_PTE_YOUNG
-	tstne	r1, #L_PTE_PRESENT
-	moveq	r3, #0
-
+set_pte:

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

PATCH 1/1 Skip unnecessary pte makeup when clearing it.

Quoted 31 lines · Uwe Kleine-K?nig
Quoted 16 lines · On Wed, Jan 18, 2012 at 05:52:25PM +0800, bill4carson at gmail.com wrote:

From: Bill Carson<[email protected]>

If we are only about to clear a hardware pte entry, then pte makeup code is unnecessary for cpu_v7_set_pte_ext and armv6_set_pte_ext, so just skip it.

---
  arch/arm/mm/proc-macros.S    |   10 +++++-----
  arch/arm/mm/proc-v7-2level.S |   10 +++++-----
  2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mm/proc-macros.S +0 -0
index 2d8ff3a..11288b3 100644

arch/arm/mm/proc-macros.S line 147

Quoted 10 lines
arch/arm/mm/proc-macros.S +4 -0
@@ -138,6 +138,10 @@
  	.macro	armv6_set_pte_ext pfx
  	str	r1, [r0], #2048			@ linux version
 
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	moveq	set_pte
  	bic	r3, r1, #0x000003fc
  	bic	r3, r3, #PTE_TYPE_MASK
  	orr	r3, r3, r2

I guess you want

beq set_pte

Quoted 9 lines

instead of

moveq set_pte

here?!

Additionally this doesn't seem to be able to be compiled to thumb. I don't know if it must be though.

Hi Uwe

Thanks for your reply :) I compile with following thumb configuration build and run on hardware board show nothing wrong on my side. I am not aware of any other THUMB configuration, so could you give me more information about your concern ?

iamroot at iamroot-OptiPlex-780:~/workbench/vm_zone/linux/linux-2.6$ cat .config | grep THUMB
CONFIG_ARM_THUMB=y
CONFIG_ARM_THUMBEE=y
CONFIG_THUMB2_KERNEL=y CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11=y CONFIG_XZ_DEC_ARMTHUMB=y

00000028 <cpu_v7_set_pte_ext>:
28: 6001 str r1, [r0, #0]
2a: f011 0f02 tst.w r1, #2
2e: bf12 itee ne
30: f011 0f01 tstne.w r1, #1
34: 2300 moveq r3, #0
36: e01d beq.n 74 <cpu_v7_set_pte_ext+0x4c>
38: f421 737c bic.w r3, r1, #1008 ; 0x3f0
3c: f023 0303 bic.w r3, r3, #3
40: ea43 0302 orr.w r3, r3, r2
44: f043 0312 orr.w r3, r3, #18
48: f011 0f10 tst.w r1, #16
4c: bf18 it ne
4e: f043 0340 orrne.w r3, r3, #64 ; 0x40
52: f081 0140 eor.w r1, r1, #64 ; 0x40
56: f011 0fc0 tst.w r1, #192 ; 0xc0
5a: bf18 it ne
5c: f443 7300 orrne.w r3, r3, #512 ; 0x200
60: f411 7f80 tst.w r1, #256 ; 0x100
64: bf18 it ne
66: f043 0320 orrne.w r3, r3, #32
6a: f411 7f00 tst.w r1, #512 ; 0x200
6e: bf18 it ne
70: f043 0301 orrne.w r3, r3, #1
74: f500 6000 add.w r0, r0, #2048 ; 0x800
78: 6003 str r3, [r0, #0]
7a: ee07 0f3a mcr 15, 0, r0, cr7, cr10, {1}
7e: 46f7 mov pc, lr

Quoted 13 lines

arch/arm/mm/proc-macros.S line 170

Quoted 10 lines
arch/arm/mm/proc-macros.S +1 -5
@@ -163,11 +167,7 @@
  	orrne	r3, r3, #PTE_EXT_XN
 
  	orr	r3, r3, r2
-
-	tst	r1, #L_PTE_YOUNG
-	tstne	r1, #L_PTE_PRESENT
-	moveq	r3, #0
-
+set_pte:

Best regards
Uwe

Signature · 4 lines
I am a slow learner
but I will keep trying to fight for my dreams!

--bill
#3 lore raw

PATCH 1/1 Skip unnecessary pte makeup when clearing it.

In reply to bill4carson at gmail.com
Quoted 16 lines · On Wed, Jan 18, 2012 at 09:52:25AM +0000, bill4carson at gmail.com wrote:

From: Bill Carson <[email protected]>

If we are only about to clear a hardware pte entry, then pte makeup code is unnecessary for cpu_v7_set_pte_ext and armv6_set_pte_ext, so just skip it.

---
 arch/arm/mm/proc-macros.S    |   10 +++++-----
 arch/arm/mm/proc-v7-2level.S |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mm/proc-macros.S +0 -0
index 2d8ff3a..11288b3 100644

arch/arm/mm/proc-macros.S line 144

Quoted 7 lines
arch/arm/mm/proc-macros.S +4 -0
@@ -138,6 +138,10 @@
 	.macro	armv6_set_pte_ext pfx
 	str	r1, [r0], #2048			@ linux version
 
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	moveq	set_pte

As Uwe said, "beq" here and you could use numerical labels like "1f".

Signature · 1 line
Catalin
#4 lore raw

PATCH 1/1 Skip unnecessary pte makeup when clearing it.

Quoted 20 lines · Catalin Marinas
Quoted 19 lines · On Wed, Jan 18, 2012 at 09:52:25AM +0000, bill4carson at gmail.com wrote:

From: Bill Carson<[email protected]>

If we are only about to clear a hardware pte entry, then pte makeup code is unnecessary for cpu_v7_set_pte_ext and armv6_set_pte_ext, so just skip it.

---
  arch/arm/mm/proc-macros.S    |   10 +++++-----
  arch/arm/mm/proc-v7-2level.S |   10 +++++-----
  2 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mm/proc-macros.S +0 -0
index 2d8ff3a..11288b3 100644
@@ -138,6 +138,10 @@
  	.macro	armv6_set_pte_ext pfx
  	str	r1, [r0], #2048			@ linux version
 
Quoted 6 lines

arch/arm/mm/proc-macros.S line 144

Quoted 4 lines
arch/arm/mm/proc-macros.S +4 -0
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	moveq	set_pte

As Uwe said, "beq" here and you could use numerical labels like "1f".

Yes, I made a terrible mistake about "beq" :-[
I will send v2 after Uwe compile thumb successfully with this patch.

Signature · 4 lines
I am a slow learner
but I will keep trying to fight for my dreams!

--bill