linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] arm64: ftrace: eliminate literal pool entries
@ 2014-11-07 14:12 Ard Biesheuvel
  2014-11-07 14:12 ` [PATCH 2/2] arm64: kvm: " Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2014-11-07 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

Replace ldr xN, =<symbol> with adrp/add or adrp/ldr [as appropriate]
in the implementation of _mcount(), which may be called very often.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/kernel/entry-ftrace.S | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index 38e704e597f7..08cafc518b9a 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -98,8 +98,8 @@
 ENTRY(_mcount)
 	mcount_enter
 
-	ldr	x0, =ftrace_trace_function
-	ldr	x2, [x0]
+	adrp	x0, ftrace_trace_function
+	ldr	x2, [x0, #:lo12:ftrace_trace_function]
 	adr	x0, ftrace_stub
 	cmp	x0, x2			// if (ftrace_trace_function
 	b.eq	skip_ftrace_call	//     != ftrace_stub) {
@@ -115,14 +115,15 @@ skip_ftrace_call:			//   return;
 	mcount_exit			//   return;
 					// }
 skip_ftrace_call:
-	ldr	x1, =ftrace_graph_return
-	ldr	x2, [x1]		//   if ((ftrace_graph_return
-	cmp	x0, x2			//        != ftrace_stub)
-	b.ne	ftrace_graph_caller
-
-	ldr	x1, =ftrace_graph_entry	//     || (ftrace_graph_entry
-	ldr	x2, [x1]		//        != ftrace_graph_entry_stub))
-	ldr	x0, =ftrace_graph_entry_stub
+	adrp	x1, ftrace_graph_return
+	ldr	x2, [x1, #:lo12:ftrace_graph_return]
+	cmp	x0, x2			//   if ((ftrace_graph_return
+	b.ne	ftrace_graph_caller	//        != ftrace_stub)
+
+	adrp	x1, ftrace_graph_entry	//     || (ftrace_graph_entry
+	adrp	x0, ftrace_graph_entry_stub //     != ftrace_graph_entry_stub))
+	ldr	x2, [x1, #:lo12:ftrace_graph_entry]
+	add	x0, x0, #:lo12:ftrace_graph_entry_stub
 	cmp	x0, x2
 	b.ne	ftrace_graph_caller	//     ftrace_graph_caller();
 
-- 
1.8.3.2

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

* [PATCH 2/2] arm64: kvm: eliminate literal pool entries
  2014-11-07 14:12 [PATCH 1/2] arm64: ftrace: eliminate literal pool entries Ard Biesheuvel
@ 2014-11-07 14:12 ` Ard Biesheuvel
  2014-11-07 14:44   ` Marc Zyngier
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2014-11-07 14:12 UTC (permalink / raw)
  To: linux-arm-kernel

Replace two instances of 'ldr xN, =(constant)' in the world switch
hot path with 'mov' instructions.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/kvm/hyp.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index b72aa9f9215c..fbe909fb0a1a 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -761,10 +761,10 @@
 .macro activate_traps
 	ldr     x2, [x0, #VCPU_HCR_EL2]
 	msr     hcr_el2, x2
-	ldr	x2, =(CPTR_EL2_TTA)
+	mov	x2, #CPTR_EL2_TTA
 	msr	cptr_el2, x2
 
-	ldr	x2, =(1 << 15)	// Trap CP15 Cr=15
+	mov	x2, #(1 << 15)	// Trap CP15 Cr=15
 	msr	hstr_el2, x2
 
 	mrs	x2, mdcr_el2
-- 
1.8.3.2

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

* [PATCH 2/2] arm64: kvm: eliminate literal pool entries
  2014-11-07 14:12 ` [PATCH 2/2] arm64: kvm: " Ard Biesheuvel
@ 2014-11-07 14:44   ` Marc Zyngier
  2014-11-07 14:51     ` Christoffer Dall
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2014-11-07 14:44 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/11/14 14:12, Ard Biesheuvel wrote:
> Replace two instances of 'ldr xN, =(constant)' in the world switch
> hot path with 'mov' instructions.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/arm64/kvm/hyp.S | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
> index b72aa9f9215c..fbe909fb0a1a 100644
> --- a/arch/arm64/kvm/hyp.S
> +++ b/arch/arm64/kvm/hyp.S
> @@ -761,10 +761,10 @@
>  .macro activate_traps
>  	ldr     x2, [x0, #VCPU_HCR_EL2]
>  	msr     hcr_el2, x2
> -	ldr	x2, =(CPTR_EL2_TTA)
> +	mov	x2, #CPTR_EL2_TTA
>  	msr	cptr_el2, x2
>  
> -	ldr	x2, =(1 << 15)	// Trap CP15 Cr=15
> +	mov	x2, #(1 << 15)	// Trap CP15 Cr=15
>  	msr	hstr_el2, x2
>  
>  	mrs	x2, mdcr_el2
> 

Looks good to me.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.
-- 
Jazz is not dead. It just smells funny...

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

* [PATCH 2/2] arm64: kvm: eliminate literal pool entries
  2014-11-07 14:44   ` Marc Zyngier
@ 2014-11-07 14:51     ` Christoffer Dall
  2014-11-07 15:03       ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Christoffer Dall @ 2014-11-07 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 07, 2014 at 02:44:28PM +0000, Marc Zyngier wrote:
> On 07/11/14 14:12, Ard Biesheuvel wrote:
> > Replace two instances of 'ldr xN, =(constant)' in the world switch
> > hot path with 'mov' instructions.
> > 
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> >  arch/arm64/kvm/hyp.S | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
> > index b72aa9f9215c..fbe909fb0a1a 100644
> > --- a/arch/arm64/kvm/hyp.S
> > +++ b/arch/arm64/kvm/hyp.S
> > @@ -761,10 +761,10 @@
> >  .macro activate_traps
> >  	ldr     x2, [x0, #VCPU_HCR_EL2]
> >  	msr     hcr_el2, x2
> > -	ldr	x2, =(CPTR_EL2_TTA)
> > +	mov	x2, #CPTR_EL2_TTA
> >  	msr	cptr_el2, x2
> >  
> > -	ldr	x2, =(1 << 15)	// Trap CP15 Cr=15
> > +	mov	x2, #(1 << 15)	// Trap CP15 Cr=15
> >  	msr	hstr_el2, x2
> >  
> >  	mrs	x2, mdcr_el2
> > 
> 
> Looks good to me.
> 
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> 
Yup, me too:

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>

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

* [PATCH 2/2] arm64: kvm: eliminate literal pool entries
  2014-11-07 14:51     ` Christoffer Dall
@ 2014-11-07 15:03       ` Will Deacon
  0 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2014-11-07 15:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Nov 07, 2014 at 02:51:50PM +0000, Christoffer Dall wrote:
> On Fri, Nov 07, 2014 at 02:44:28PM +0000, Marc Zyngier wrote:
> > On 07/11/14 14:12, Ard Biesheuvel wrote:
> > > Replace two instances of 'ldr xN, =(constant)' in the world switch
> > > hot path with 'mov' instructions.
> > > 
> > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > ---
> > >  arch/arm64/kvm/hyp.S | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
> > > index b72aa9f9215c..fbe909fb0a1a 100644
> > > --- a/arch/arm64/kvm/hyp.S
> > > +++ b/arch/arm64/kvm/hyp.S
> > > @@ -761,10 +761,10 @@
> > >  .macro activate_traps
> > >  	ldr     x2, [x0, #VCPU_HCR_EL2]
> > >  	msr     hcr_el2, x2
> > > -	ldr	x2, =(CPTR_EL2_TTA)
> > > +	mov	x2, #CPTR_EL2_TTA
> > >  	msr	cptr_el2, x2
> > >  
> > > -	ldr	x2, =(1 << 15)	// Trap CP15 Cr=15
> > > +	mov	x2, #(1 << 15)	// Trap CP15 Cr=15
> > >  	msr	hstr_el2, x2
> > >  
> > >  	mrs	x2, mdcr_el2
> > > 
> > 
> > Looks good to me.
> > 
> > Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> > 
> Yup, me too:
> 
> Acked-by: Christoffer Dall <christoffer.dall@linaro.org>

Cheers guys, I've applied both patches to the arm64 tree for 3.19.

Will

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

end of thread, other threads:[~2014-11-07 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 14:12 [PATCH 1/2] arm64: ftrace: eliminate literal pool entries Ard Biesheuvel
2014-11-07 14:12 ` [PATCH 2/2] arm64: kvm: " Ard Biesheuvel
2014-11-07 14:44   ` Marc Zyngier
2014-11-07 14:51     ` Christoffer Dall
2014-11-07 15:03       ` 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).