[PATCHv2 1/6] ARM: ftrace: remove useless memory checks

Russell King - ARM Linux linux at arm.linux.org.uk
Mon Feb 20 11:16:01 EST 2012


On Sat, Jan 28, 2012 at 07:05:20PM +0530, Rabin Vincent wrote:
> Before replacing an instruction, the ftrace code determines what the old
> instruction should be and verifies that that's what's really there in
> memory before replacing it.  This is useful if for example a bug in
> mcountrecord causes it to record wrong locations.
> 
> However, in cases where we replace call sites in entry-common.S, these
> checks are not needed.  For these, we currently just memcpy() the memory
> content and then "verify" it -- this is quite useless and can be
> removed.

Yes, I know this is a little late, but...

> 
> Signed-off-by: Rabin Vincent <rabin at rab.in>
> ---
>  arch/arm/kernel/ftrace.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
> index c0062ad..e9488ad 100644
> --- a/arch/arm/kernel/ftrace.c
> +++ b/arch/arm/kernel/ftrace.c
> @@ -125,11 +125,13 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
>  {
>  	unsigned long replaced;
>  
> -	if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
> -		return -EFAULT;
> +	if (old) {

So, we're using the instruction value '0' to mean that we don't want to
check?  Wouldn'it it be better to pass a flag in to indicate this instead
of creating a magic value?



More information about the linux-arm-kernel mailing list