From: Ralf Baechle <ralf@linux-mips.org>
To: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: rostedt@goodmis.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 10/10] tracing: make function graph tracer work with -mmcount-ra-address
Date: Fri, 20 Nov 2009 17:25:42 +0000 [thread overview]
Message-ID: <20091120172542.GJ6869@linux-mips.org> (raw)
In-Reply-To: <7f3448d0d795a7f60dc9731e95123ae9e0f4d56a.1258719323.git.wuzhangjin@gmail.com>
On Fri, Nov 20, 2009 at 08:34:38PM +0800, Wu Zhangjin wrote:
> That thread "MIPS: Add option to pass return address location to
> _mcount" from "David Daney <ddaney@caviumnetworks.com>" have added a new
> option -mmcount-ra-address to gcc(4.5) for MIPS to transfer the location
> of the return address to _mcount.
>
> Benefit from this new feature, function graph tracer on MIPS will be
> easier and safer to hijack the return address of the kernel function,
> which will save some overhead and make the whole thing more reliable.
>
> In this patch, at first, try to enable the option -mmcount-ra-address in
> arch/mips/Makefile with cc-option, if gcc support it, it will be
> enabled, otherwise, no side effect.
>
> and then, we need to support this new option of gcc 4.5 and also support
> the old gcc versions.
>
> with _mcount in the old gcc versions, it's not easy to get the location
> of return address(tracing: add function graph tracer support for MIPS),
> so, we do it in a C function: ftrace_get_parent_addr(ftrace.c), but
> with -mmcount-ra-address, only several instructions need to get what
> we want, so, I put into asm(mcount.S). and also, as the $12(t0) is
> used by -mmcount-ra-address for transferring the localtion of return
> address to _mcount, we need to save it into the stack and restore it
> when enabled dynamic function tracer, 'Cause we have called
> "ftrace_call" before "ftrace_graph_caller", which may destroy
> $12(t0).
>
> (Thanks to David for providing that -mcount-ra-address and giving the
> idea of KBUILD_MCOUNT_RA_ADDRESS, both of them have made the whole
> thing more beautiful!)
>
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Queued for 2.6.33 but due to patch 3/3 I won't propagate this series
immediately to linux-next.
Thanks!
Ralf
prev parent reply other threads:[~2009-11-20 17:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 12:28 [PATCH v9 00/10] ftrace for MIPS 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
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 [this message]
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=20091120172542.GJ6869@linux-mips.org \
--to=ralf@linux-mips.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=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).