mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Nicholas Mc Guire <der.herr@hofr.at>,
	zhangfx@lemote.com, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH v9 04/10] tracing: add dynamic function tracer support for MIPS
Date: Thu, 03 Dec 2009 12:54:53 -0500	[thread overview]
Message-ID: <1259862893.12870.141.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <6a25a6132d64830bbd7339fe8b3841a51d02ac6d.1258719323.git.wuzhangjin@gmail.com>

On Fri, 2009-11-20 at 20:34 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 

> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  arch/mips/Kconfig              |    2 +
>  arch/mips/include/asm/ftrace.h |    9 +++
>  arch/mips/kernel/Makefile      |    3 +-
>  arch/mips/kernel/ftrace.c      |  112 ++++++++++++++++++++++++++++++++++++++++
>  arch/mips/kernel/mcount.S      |   29 ++++++++++


>  scripts/recordmcount.pl        |   54 +++++++++++++++++++


>  6 files changed, 208 insertions(+), 1 deletions(-)
>  create mode 100644 arch/mips/kernel/ftrace.c
> 



> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 24604d4..9d80d0d 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -295,6 +295,60 @@ if ($arch eq "x86_64") {
>      $ld .= " -m elf64_sparc";
>      $cc .= " -m64";
>      $objcopy .= " -O elf64-sparc";
> +
> +} elsif ($arch eq "mips") {
> +    # To enable module support, we need to enable the -mlong-calls option
> +    # of gcc for module, after using this option, we can not get the real
> +    # offset of the calling to _mcount, but the offset of the lui
> +    # instruction or the addiu one. herein, we record the address of the
> +    # first one, and then we can replace this instruction by a branch
> +    # instruction to jump over the profiling function to filter the
> +    # indicated functions, or swith back to the lui instruction to trace
> +    # them, which means dynamic tracing.
> +    #
> +    #       c:	3c030000 	lui	v1,0x0
> +    #			c: R_MIPS_HI16	_mcount
> +    #			c: R_MIPS_NONE	*ABS*
> +    #			c: R_MIPS_NONE	*ABS*
> +    #      10:	64630000 	daddiu	v1,v1,0
> +    #			10: R_MIPS_LO16	_mcount
> +    #			10: R_MIPS_NONE	*ABS*
> +    #			10: R_MIPS_NONE	*ABS*
> +    #      14:	03e0082d 	move	at,ra
> +    #      18:	0060f809 	jalr	v1
> +    #
> +    # for the kernel:
> +    #
> +    #     10:   03e0082d        move    at,ra
> +    #	  14:   0c000000        jal     0 <loongson_halt>
> +    #                    14: R_MIPS_26   _mcount
> +    #                    14: R_MIPS_NONE *ABS*
> +    #                    14: R_MIPS_NONE *ABS*
> +    #	 18:   00020021        nop
> +    if ($is_module eq "0") {
> +	    $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
> +    } else {
> +	    $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$";
> +    }
> +    $objdump .= " -Melf-trad".$endian."mips ";
> +
> +    if ($endian eq "big") {
> +	    $endian = " -EB ";
> +	    $ld .= " -melf".$bits."btsmip";
> +    } else {
> +	    $endian = " -EL ";
> +	    $ld .= " -melf".$bits."ltsmip";
> +    }
> +
> +    $cc .= " -mno-abicalls -fno-pic -mabi=" . $bits . $endian;
> +    $ld .= $endian;
> +
> +    if ($bits == 64) {
> +	    $function_regex =
> +		"^([0-9a-fA-F]+)\\s+<(.|[^\$]L.*?|\$[^L].*?|[^\$][^L].*?)>:";
> +	    $type = ".dword";
> +    }
> +
>  } else {
>      die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
>  }

This only adds MIPS arch support to recordmcount.pl, and does not touch
any other arch or generic code. Thus, I consider this arch specific
code.

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

-- Steve



  parent reply	other threads:[~2009-12-03 17:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-20 12:28 [PATCH v9 00/10] ftrace " Wu Zhangjin
2009-11-20 12:34 ` [PATCH v9 01/10] tracing: add static function tracer support " Wu Zhangjin
2009-11-20 17:22   ` Ralf Baechle
2009-11-20 12:34 ` [PATCH v9 02/10] tracing: enable HAVE_FUNCTION_TRACE_MCOUNT_TEST " Wu Zhangjin
2009-11-20 17:22   ` Ralf Baechle
2009-11-20 12:34 ` [PATCH v9 03/10] tracing: add an endian argument to scripts/recordmcount.pl Wu Zhangjin
2009-11-20 17:20   ` Ralf Baechle
2009-12-03 17:45   ` Steven Rostedt
2009-11-20 12:34 ` [PATCH v9 04/10] tracing: add dynamic function tracer support for MIPS Wu Zhangjin
2009-11-20 17:23   ` Ralf Baechle
2009-12-03 17:54   ` Steven Rostedt [this message]
2009-11-20 12:34 ` [PATCH v9 05/10] tracing: add IRQENTRY_EXIT section " Wu Zhangjin
2009-11-20 17:23   ` Ralf Baechle
2009-11-20 12:34 ` [PATCH v9 06/10] tracing: add function graph tracer support " Wu Zhangjin
2009-11-20 17:24   ` Ralf Baechle
2009-11-20 12:34 ` [PATCH v9 07/10] tracing: add dynamic function graph tracer " Wu Zhangjin
2009-11-20 17:24   ` Ralf Baechle
2009-11-22  6:19     ` Wu Zhangjin
2009-11-20 12:34 ` [PATCH v9 08/10] tracing: make ftrace for MIPS work without -fno-omit-frame-pointer Wu Zhangjin
2009-11-20 17:24   ` Ralf Baechle
2009-11-20 12:34 ` [PATCH v9 09/10] tracing: reserve $12(t0) for mcount-ra-address of gcc 4.5 Wu Zhangjin
2009-11-20 17:25   ` Ralf Baechle
2009-11-20 12:34 ` [PATCH v9 10/10] tracing: make function graph tracer work with -mmcount-ra-address Wu Zhangjin
2009-11-20 17:25   ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259862893.12870.141.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=der.herr@hofr.at \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®