Skip to contentSkip to conversation

Skip unnecessary pte makeup when clearing it

PATCH Superseded bill4carson at gmail.com 2 participants 4 messages Jan 30, 2012 Arm (32-bit)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

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.

Cc Catalin Marinas <[email protected]>
Cc Uwe Kleine-K?nig <[email protected]>
Cc arm-mail-list <[email protected]>

Changes for V2:
- Use "1f" instead of "set_pte" as label
- Build/bootup test with thumb mode
- checkpatch script shows:
total: 0 errors, 0 warnings, 44 lines checked

./0001-Skip-unnecessary-pte-makeup-when-clearing-it.patch has no obvious style problems and is ready for submission.

 arch/arm/mm/proc-macros.S    |   10 +++++-----
 arch/arm/mm/proc-v7-2level.S |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
#1 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..907b524 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
+	beq	1f
 	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
-
+1:
 	str	r3, [r0]
 	mcr	p15, 0, r0, c7, c10, 1		@ flush_pte
 	.endm
arch/arm/mm/proc-v7-2level.S +5 -5
index 3a4b3e7..869bebc 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		1f
 	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
-
+1:
  ARM(	str	r3, [r0, #2048]! )
  THUMB(	add	r0, r0, #2048 )
  THUMB(	str	r3, [r0] )
Signature · 1 line
1.7.1
#2 lore raw

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

Quoted 44 lines · On Mon, Jan 30, 2012 at 09:47:51AM +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 +5 -5
index 2d8ff3a..907b524 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
+	beq	1f
 	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
-
+1:
 	str	r3, [r0]
 	mcr	p15, 0, r0, c7, c10, 1		@ flush_pte
 	.endm
arch/arm/mm/proc-v7-2level.S +0 -0
index 3a4b3e7..869bebc 100644

arch/arm/mm/proc-v7-2level.S ENTRY(cpu_v7_set_pte_ext) · line 82

Quoted 7 lines
arch/arm/mm/proc-v7-2level.S +4 -0
@@ -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		1f

This double tab looks wrong. Other than that I think the patch is OK. Note I don't have a clue about ptes but your changes are a logical nop.

Best regards
Uwe

Quoted 16 lines
arch/arm/mm/proc-v7-2level.S +1 -5
 	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
-
+1:
  ARM(	str	r3, [r0, #2048]! )
  THUMB(	add	r0, r0, #2048 )
  THUMB(	str	r3, [r0] )
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

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

Quoted 48 lines · Uwe Kleine-K?nig
Quoted 47 lines · On Mon, Jan 30, 2012 at 09:47:51AM +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 +5 -5
index 2d8ff3a..907b524 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
+	beq	1f
  	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
-
+1:
  	str	r3, [r0]
  	mcr	p15, 0, r0, c7, c10, 1		@ flush_pte
  	.endm
arch/arm/mm/proc-v7-2level.S +0 -0
index 3a4b3e7..869bebc 100644
@@ -76,6 +76,10 @@ ENTRY(cpu_v7_set_pte_ext)
  #ifdef CONFIG_MMU
  	str	r1, [r0]			@ linux version
 
Quoted 7 lines

arch/arm/mm/proc-v7-2level.S ENTRY(cpu_v7_set_pte_ext) · line 82

Quoted 4 lines
arch/arm/mm/proc-v7-2level.S +4 -0
+	tst	r1, #L_PTE_YOUNG
+	tstne	r1, #L_PTE_PRESENT
+	moveq	r3, #0
+	beq		1f

This double tab looks wrong. Other than that I think the patch is OK. Note I don't have a clue about ptes but your changes are a logical nop.

Thanks for your feedback :)

I will fix that double tab soon, as for "your changes are a logical nop" it does not change any code substantially, changing the sequence does not help when setup an page mapping, but it take a short path when clearing an existing pte, thus gives better performance.

Quoted 19 lines

Best regards
Uwe

Quoted 16 lines
arch/arm/mm/proc-v7-2level.S +1 -5
  	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
-
+1:
   ARM(	str	r3, [r0, #2048]! )
   THUMB(	add	r0, r0, #2048 )
   THUMB(	str	r3, [r0] )
Signature · 4 lines
I am a slow learner
but I will keep trying to fight for my dreams!

--bill