All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: linux-mips@linux-mips.org, ralf@linux-mips.org
Cc: David Daney <ddaney@caviumnetworks.com>,
	rostedt@goodmis.org, Wu Zhangjin <wuzhangjin@gmail.com>
Subject: [RFC 0/2] Fixes the modules support of dynamic function tracer for MIPS
Date: Sat, 23 Oct 2010 04:58:01 +0800	[thread overview]
Message-ID: <cover.1287779153.git.wuzhangjin@gmail.com> (raw)

From: Wu Zhangjin <wuzhangjin@gmail.com>

Hi, all

Currently, our in_module() defined in arch/mips/kernel/ftrace.c and
scripts/recordmcount.pl for MIPS only considers the module and the core kernel
have different address space and long call is assumed to be used.

But as David pointed before, the module may be in the same space as the core
kernel, therefore, with the current implementation, dynamic function tracer for
MIPS will not work for that situation.

This patchset is created to fix it.

As we know, to jump from an address to _mcount, for _mcount is in kernel space,
if the address is also in kernel space, then, no long call is needed(for the
"jal" can jump to a place whose offset is smaller than 2^28=256MB and
no kernel image is possible to be bigger than 256MB), otherwise, (only
consider the address passed by ftrace_make_{nop,call}), to jump from
the address to _mcount, long call via "jalr" is needed:

if (in_kernel_space(addr)) {
	jal _mcount;
} else {
	load the address of _mcount to a register
	jalr <register>
}

Now, after implementing in_kernel_space() in the 1st patch, that
situation(module and core kernel are in the same address space) is also covered.

But the 1st patch is not enough to fix the whole problem, we also need to
record the right calling site(for long call, not really the calling site, but
the position for loading the address to the register) for the module in that
situation. Because no long call is needed for that situation, to get the
calling site to _mcount, we need to search the R_MIPS_26 like the kernel, the
2nd patch does it.

Regards,
	Wu Zhangjin

Wu Zhangjin (2):
  MIPS: tracing/ftrace: Replace in_module() with a generic
    in_kernel_space()
  MIPS: tracing/ftrace: Fixes mcount_regex for modules

 arch/mips/kernel/ftrace.c |   66 ++++++++++++++++++++++++--------------------
 scripts/recordmcount.pl   |   46 +++++++++++++++++++-----------
 2 files changed, 65 insertions(+), 47 deletions(-)

             reply	other threads:[~2010-10-22 20:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 20:58 Wu Zhangjin [this message]
2010-10-22 20:58 ` [RFC 1/2] MIPS: tracing/ftrace: Replace in_module() with a generic in_kernel_space() Wu Zhangjin
2010-10-22 21:31   ` David Daney
2010-10-23  5:51     ` wu zhangjin
2010-10-27 11:11   ` wu zhangjin
2010-10-22 20:58 ` [RFC 2/2] MIPS: tracing/ftrace: Fixes mcount_regex for modules Wu Zhangjin
2010-10-22 21:10   ` David Daney
2010-10-22 21:31     ` Steven Rostedt
2010-10-23  6:03       ` 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=cover.1287779153.git.wuzhangjin@gmail.com \
    --to=wuzhangjin@gmail.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=rostedt@goodmis.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.