From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Liming <liming.wang@windriver.com>,
linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
Ralf Baechle <ralf@linux-mips.org>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Nicholas Mc Guire <der.herr@hofr.at>
Subject: Re: [PATCH v2 2/6] mips dynamic function tracer support
Date: Thu, 04 Jun 2009 19:20:34 +0800 [thread overview]
Message-ID: <1244114434.31146.48.camel@falcon> (raw)
In-Reply-To: <alpine.DEB.2.00.0906030841040.14994@gandalf.stny.rr.com>
hi, Steven
> Note, PowerPC uses a trampoline from modules to kernel core. I think MIPS
> just calls mcount differently. That is, it does a full 32bit address call
> (64 bit for 64 bit archs?). Something like:
>
> lui v1, _mcount
> addiu v1, v1, _mcount
> jalr v1
> addiu sp, sp, -8
>
> Then a nop would not do. Due to preemption, we can not modify more than
> one line. But you could modify it to:
>
> b 1f
> addiu v1, v1, _mcount
> jalr v1
> addiu sp, sp, -8
> 1:
>
> Clobbering v1 should not be an issue since it is already used to store
> _mcount. That is, we still do the addiu v1,v1,_mcount with that branch.
> But v1 should be ignored.
>
sorry, I'm not clear what you said above, could you give more
explanation on it, thanks!
I think "jal _mcount" itself will not work in static and dynamic ftrace.
something like what you described above should be used instead. perhaps
a PATCH can be sent to gcc or we use some tricks in kernel.
if we not use the method of modifying the kernel code in run time(avoid
preemption?), can we link something as following to the modules:
_mcount_trampoline:
PTR_LA t0, _mcount
jalr t0
and then we replace the original "jal _mcount" in every module to "jal
_mcount_trampoline" with a perl script.
this solution maybe work for static ftrace. does it?
but in dynamic ftrace, when ftrace is enabled and set_filter_function is
set, the place of filtered function will be substituted to "jal
ftrace_caller", this will not work since ftrace_caller is a function
like _mcount, which will not reached in modules. so, this ftrace_caller
should be substituted to something like this:
ftrace_caller_trampoline:
PTR_LA t0, ftrace_caller
jalr t0
and ftrace_caller_trampoline should be linked to modules too. or we
substituted it to the above _mcount_trampoline, but change "PTR_LA t0,
_mcount" to "PTR_LA t0, ftrace_caller".
does this work?
thanks!
Wu Zhangjin
next prev parent reply other threads:[~2009-06-04 11:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-29 14:58 [PATCH v2 0/6] mips-specific ftrace support wuzhangjin
2009-05-29 15:02 ` [PATCH v2 1/6] mips static function tracer support wuzhangjin
2009-05-29 15:03 ` [PATCH v2 2/6] mips dynamic " wuzhangjin
2009-05-29 15:24 ` Steven Rostedt
2009-05-29 16:06 ` Wu Zhangjin
2009-05-29 17:22 ` Wu Zhangjin
2009-05-29 18:36 ` Wu Zhangjin
2009-05-31 6:47 ` Wang Liming
2009-06-02 16:15 ` wu zhangjin
2009-06-03 6:05 ` Wang Liming
2009-06-03 12:47 ` Steven Rostedt
2009-06-04 11:20 ` Wu Zhangjin [this message]
2009-05-29 15:04 ` [PATCH v2 3/6] add an endian argument to scripts/recordmcount.pl wuzhangjin
2009-05-29 15:21 ` Steven Rostedt
2009-05-29 15:05 ` [PATCH v2 4/6] mips function graph tracer support wuzhangjin
2009-05-29 15:05 ` [PATCH v2 5/6] mips specific clock function to get precise timestamp wuzhangjin
2009-05-29 15:06 ` [PATCH v2 6/6] mips specific system call tracer wuzhangjin
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=1244114434.31146.48.camel@falcon \
--to=wuzhangjin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=der.herr@hofr.at \
--cc=fweisbec@gmail.com \
--cc=liming.wang@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mingo@elte.hu \
--cc=ralf@linux-mips.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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).