All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ftrace: Kill ftrace_caller_end label
@ 2015-12-14 16:08 Borislav Petkov
  2015-12-14 16:30 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2015-12-14 16:08 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

One of ftrace_caller_and and ftrace_return is redundant so unify them.
Rename ftrace_return to ftrace_epilogue to mean that everything after
that label represents, like an afterword, work which happens *after* the
ftrace call, e.g., the function graph tracer for one.

Beef up the comment about the code contents and layout before
ftrace_epilogue label.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
 arch/x86/kernel/ftrace.c    | 11 +++++------
 arch/x86/kernel/mcount_64.S | 14 ++++++++------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 311bcf338f07..26ad092ac0dc 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -690,9 +690,8 @@ static inline void tramp_free(void *tramp) { }
 #endif
 
 /* Defined as markers to the end of the ftrace default trampolines */
-extern void ftrace_caller_end(void);
 extern void ftrace_regs_caller_end(void);
-extern void ftrace_return(void);
+extern void ftrace_epilogue(void);
 extern void ftrace_caller_op_ptr(void);
 extern void ftrace_regs_caller_op_ptr(void);
 
@@ -739,7 +738,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
 		op_offset = (unsigned long)ftrace_regs_caller_op_ptr;
 	} else {
 		start_offset = (unsigned long)ftrace_caller;
-		end_offset = (unsigned long)ftrace_caller_end;
+		end_offset = (unsigned long)ftrace_epilogue;
 		op_offset = (unsigned long)ftrace_caller_op_ptr;
 	}
 
@@ -747,7 +746,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
 
 	/*
 	 * Allocate enough size to store the ftrace_caller code,
-	 * the jmp to ftrace_return, as well as the address of
+	 * the jmp to ftrace_epilogue, as well as the address of
 	 * the ftrace_ops this trampoline is used for.
 	 */
 	trampoline = alloc_tramp(size + MCOUNT_INSN_SIZE + sizeof(void *));
@@ -765,8 +764,8 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
 
 	ip = (unsigned long)trampoline + size;
 
-	/* The trampoline ends with a jmp to ftrace_return */
-	jmp = ftrace_jmp_replace(ip, (unsigned long)ftrace_return);
+	/* The trampoline ends with a jmp to ftrace_epilogue */
+	jmp = ftrace_jmp_replace(ip, (unsigned long)ftrace_epilogue);
 	memcpy(trampoline + size, jmp, MCOUNT_INSN_SIZE);
 
 	/*
diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index 87e1762e2bca..ed48a9f465f8 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -168,12 +168,14 @@ GLOBAL(ftrace_call)
 	restore_mcount_regs
 
 	/*
-	 * The copied trampoline must call ftrace_return as it
+	 * The copied trampoline must call ftrace_epilogue as it
 	 * still may need to call the function graph tracer.
+	 *
+	 * The code up to this label is copied into trampolines so
+	 * think twice before adding any new code or changing the
+	 * layout here.
 	 */
-GLOBAL(ftrace_caller_end)
-
-GLOBAL(ftrace_return)
+GLOBAL(ftrace_epilogue)
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 GLOBAL(ftrace_graph_call)
@@ -244,14 +246,14 @@ GLOBAL(ftrace_regs_call)
 	popfq
 
 	/*
-	 * As this jmp to ftrace_return can be a short jump
+	 * As this jmp to ftrace_epilogue can be a short jump
 	 * it must not be copied into the trampoline.
 	 * The trampoline will add the code to jump
 	 * to the return.
 	 */
 GLOBAL(ftrace_regs_caller_end)
 
-	jmp ftrace_return
+	jmp ftrace_epilogue
 
 END(ftrace_regs_caller)
 
-- 
2.3.5


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

* Re: [PATCH] ftrace: Kill ftrace_caller_end label
  2015-12-14 16:08 [PATCH] ftrace: Kill ftrace_caller_end label Borislav Petkov
@ 2015-12-14 16:30 ` Steven Rostedt
  2015-12-14 16:41   ` Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2015-12-14 16:30 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: LKML

On Mon, 14 Dec 2015 17:08:34 +0100
Borislav Petkov <bp@alien8.de> wrote:

> From: Borislav Petkov <bp@suse.de>
> 
> One of ftrace_caller_and and ftrace_return is redundant so unify them.

s/_and/_end/

> Rename ftrace_return to ftrace_epilogue to mean that everything after
> that label represents, like an afterword, work which happens *after* the
> ftrace call, e.g., the function graph tracer for one.
> 
> Beef up the comment about the code contents and layout before
> ftrace_epilogue label.

According to http://www.thefreedictionary.com/epilog

ep·i·logue also ep·i·log  (ĕp′ə-lôg′, -lŏg′) (n).
1.
   a. A short poem or speech spoken directly to the audience following
   the conclusion of a play.

Hmm, that doesn't fit.

   b. The performer who delivers such a short poem or speech.

Maybe people can think ftrace as a poem. But people will never think
that I give such a short speech.

2. A short addition or concluding section at the end of a literary
   work, often dealing with the future of its characters. Also called
   afterword.

Ah, "afterword" also doesn't fit, unless you mean "characters" as a set
of "char []". Which I guess the trampoline would fit.

3. An event which reflects meaningfully on a recently ended conflict or
   struggle.

Ah! This looks like the best match! Thus, this should be stated in the
changelog!

> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Steven Rostedt <rostedt@goodmis.org>

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> ---
>  arch/x86/kernel/ftrace.c    | 11 +++++------
>  arch/x86/kernel/mcount_64.S | 14 ++++++++------
>  2 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> index 311bcf338f07..26ad092ac0dc 100644
> --- a/arch/x86/kernel/ftrace.c
> +++ b/arch/x86/kernel/ftrace.c
> @@ -690,9 +690,8 @@ static inline void tramp_free(void *tramp) { }
>  #endif
>  
>  /* Defined as markers to the end of the ftrace default trampolines */
> -extern void ftrace_caller_end(void);
>  extern void ftrace_regs_caller_end(void);
> -extern void ftrace_return(void);
> +extern void ftrace_epilogue(void);
>  extern void ftrace_caller_op_ptr(void);
>  extern void ftrace_regs_caller_op_ptr(void);
>  
> @@ -739,7 +738,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
>  		op_offset = (unsigned long)ftrace_regs_caller_op_ptr;
>  	} else {
>  		start_offset = (unsigned long)ftrace_caller;
> -		end_offset = (unsigned long)ftrace_caller_end;
> +		end_offset = (unsigned long)ftrace_epilogue;
>  		op_offset = (unsigned long)ftrace_caller_op_ptr;
>  	}
>  
> @@ -747,7 +746,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
>  
>  	/*
>  	 * Allocate enough size to store the ftrace_caller code,
> -	 * the jmp to ftrace_return, as well as the address of
> +	 * the jmp to ftrace_epilogue, as well as the address of
>  	 * the ftrace_ops this trampoline is used for.
>  	 */
>  	trampoline = alloc_tramp(size + MCOUNT_INSN_SIZE + sizeof(void *));
> @@ -765,8 +764,8 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
>  
>  	ip = (unsigned long)trampoline + size;
>  
> -	/* The trampoline ends with a jmp to ftrace_return */
> -	jmp = ftrace_jmp_replace(ip, (unsigned long)ftrace_return);
> +	/* The trampoline ends with a jmp to ftrace_epilogue */
> +	jmp = ftrace_jmp_replace(ip, (unsigned long)ftrace_epilogue);
>  	memcpy(trampoline + size, jmp, MCOUNT_INSN_SIZE);
>  
>  	/*
> diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
> index 87e1762e2bca..ed48a9f465f8 100644
> --- a/arch/x86/kernel/mcount_64.S
> +++ b/arch/x86/kernel/mcount_64.S
> @@ -168,12 +168,14 @@ GLOBAL(ftrace_call)
>  	restore_mcount_regs
>  
>  	/*
> -	 * The copied trampoline must call ftrace_return as it
> +	 * The copied trampoline must call ftrace_epilogue as it
>  	 * still may need to call the function graph tracer.
> +	 *
> +	 * The code up to this label is copied into trampolines so
> +	 * think twice before adding any new code or changing the
> +	 * layout here.
>  	 */
> -GLOBAL(ftrace_caller_end)
> -
> -GLOBAL(ftrace_return)
> +GLOBAL(ftrace_epilogue)
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>  GLOBAL(ftrace_graph_call)
> @@ -244,14 +246,14 @@ GLOBAL(ftrace_regs_call)
>  	popfq
>  
>  	/*
> -	 * As this jmp to ftrace_return can be a short jump
> +	 * As this jmp to ftrace_epilogue can be a short jump
>  	 * it must not be copied into the trampoline.
>  	 * The trampoline will add the code to jump
>  	 * to the return.
>  	 */
>  GLOBAL(ftrace_regs_caller_end)
>  
> -	jmp ftrace_return
> +	jmp ftrace_epilogue
>  
>  END(ftrace_regs_caller)
>  


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

* Re: [PATCH] ftrace: Kill ftrace_caller_end label
  2015-12-14 16:30 ` Steven Rostedt
@ 2015-12-14 16:41   ` Borislav Petkov
  0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2015-12-14 16:41 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML

On Mon, Dec 14, 2015 at 11:30:27AM -0500, Steven Rostedt wrote:
> On Mon, 14 Dec 2015 17:08:34 +0100
> Borislav Petkov <bp@alien8.de> wrote:
> 
> > From: Borislav Petkov <bp@suse.de>
> > 
> > One of ftrace_caller_and and ftrace_return is redundant so unify them.
> 
> s/_and/_end/

Whoops.

> > Rename ftrace_return to ftrace_epilogue to mean that everything after
> > that label represents, like an afterword, work which happens *after* the
> > ftrace call, e.g., the function graph tracer for one.
> > 
> > Beef up the comment about the code contents and layout before
> > ftrace_epilogue label.
> 
> According to http://www.thefreedictionary.com/epilog
> 
> ep·i·logue also ep·i·log  (ĕp′ə-lôg′, -lŏg′) (n).
> 1.
>    a. A short poem or speech spoken directly to the audience following
>    the conclusion of a play.
> 
> Hmm, that doesn't fit.

Huh, why doesn't that fit?

"A short code executed following the conclusion of a trampoline..." :-)

>    b. The performer who delivers such a short poem or speech.
> 
> Maybe people can think ftrace as a poem. But people will never think
> that I give such a short speech.

LOL.

> 2. A short addition or concluding section at the end of a literary
>    work, often dealing with the future of its characters. Also called
>    afterword.
> 
> Ah, "afterword" also doesn't fit, unless you mean "characters" as a set
> of "char []". Which I guess the trampoline would fit.
> 
> 3. An event which reflects meaningfully on a recently ended conflict or
>    struggle.
> 
> Ah! This looks like the best match! Thus, this should be stated in the
> changelog!

It is simply supposed to denote "stuff done after". You can call it
ftrace_post_work, ftrace_after, ...

I'm sure you're going to fix it up as you like it when applying :-)

Thanks!

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

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

end of thread, other threads:[~2015-12-14 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-14 16:08 [PATCH] ftrace: Kill ftrace_caller_end label Borislav Petkov
2015-12-14 16:30 ` Steven Rostedt
2015-12-14 16:41   ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.