Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: David Daney <ddaney@caviumnetworks.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Steven Rostedt <srostedt@redhat.com>,
	linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: tracing: Optimize the implementation
Date: Fri, 12 Mar 2010 22:57:08 +0800	[thread overview]
Message-ID: <1268405828.9527.3.camel@falcon> (raw)
In-Reply-To: <1268394209.6447.94.camel@falcon>

On Fri, 2010-03-12 at 19:43 +0800, Wu Zhangjin wrote:
[...]
> Right, then, we can search the JAL or JALR, for kernel, will get it
> immediatly, for module, will only several instructions, we can do this
> searching in ftrace_make_nop and ftrace_make_call at run-time, but just
> found we can use the following function to do it in ftrace_init(), looks
> good.
> 
> static inline int is_call_mcount(unsigned int insn)
> {
> 	return ((insn & JAL) == JAL) || (insn == JALR_V1);
> }
> 
> static inline unsinged long mcount_callsite(unsigned long addr)
> {
> 	unsigned int insn;
> 
> 	insn = *(unsigned int *)addr; /*need safe_load_code*/
> 	if (is_call_mcount(insn))
> 		return addr;
> 
> 	do {
> 		addr += 4;	/* what about big endian? */
> 		insn = *(unsigned int *)addr; /*need safe_load_code*/
> 	} while (!is_call_mcount(insn));
> 

This is not possible for modules, for currently, the modules are not
loaded yet.

Regards,
	Wu Zhangjin

  reply	other threads:[~2010-03-12 15:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11 18:07 [PATCH] MIPS: tracing: Optimize the implementation Wu Zhangjin
2010-03-12  8:50 ` Thomas Bogendoerfer
2010-03-12 10:11   ` Wu Zhangjin
2010-03-12 10:14   ` Ralf Baechle
2010-03-12 16:36   ` David Daney
     [not found] ` <4B993B32.7000006@caviumnetworks.com>
2010-03-12 11:43   ` Wu Zhangjin
2010-03-12 14:57     ` Wu Zhangjin [this message]
2010-03-13  4:10     ` Wu Zhangjin

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=1268405828.9527.3.camel@falcon \
    --to=wuzhangjin@gmail.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=srostedt@redhat.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