From: Steven Rostedt <rostedt@goodmis.org>
To: Li Hong <lihong.hi@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] tracing: recordmcount.pl Amend the documentation according to the implementation
Date: Tue, 27 Oct 2009 16:04:22 -0400 [thread overview]
Message-ID: <1256673862.26028.430.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20091027065421.GA22032@uhli>
On Tue, 2009-10-27 at 14:54 +0800, Li Hong wrote:
> In documentation, we says we will use the first function in a section as a
> reference. Actually, the algorithm is: choose the first global function we
> meet as a reference. If there is none, choose the first local one. So let the
> documentation consistent to the code.
>
> Also add several clarifications.
>
> Signed-off-by: Li Hong <lihong.hi@gmail.com>
>
> diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
> index 090d300..ac908b3 100755
> --- a/scripts/recordmcount.pl
> +++ b/scripts/recordmcount.pl
> @@ -6,73 +6,88 @@
> # all the offsets to the calls to mcount.
> #
> #
> -# What we want to end up with is a section in vmlinux called
> -# __mcount_loc that contains a list of pointers to all the
> -# call sites in the kernel that call mcount. Later on boot up, the kernel
> -# will read this list, save the locations and turn them into nops.
> -# When tracing or profiling is later enabled, these locations will then
> -# be converted back to pointers to some function.
> +# What we want to end up with this is a data area in .init.data in vmlinux
> +# that contains a list of pointers to all the call sites in the kernel that
> +# call mcount. Later on boot up, the kernel will read this list, save the
> +# locations and turn them into nops. When tracing or profiling is later
> +# enabled, these locations will then be converted back to pointers to
> +# some function.
Yes it is in .init.data, but the point is that we called it __mcount_loc
in the object files. I don't want to blindly throw that name away.
Something to the lines of this.
Each object file will have a section called __mcount_loc that will hold
the list of pointers to mcount callers. After final linking, the vmlinux
will have within .init.data the list of all callers to mcount between
_start_mcount_loc and __stop_mcount_loc.
> #
> # This is no easy feat. This script is called just after the original
> # object is compiled and before it is linked.
> #
> -# The references to the call sites are offsets from the section of text
> -# that the call site is in. Hence, all functions in a section that
> -# has a call site to mcount, will have the offset from the beginning of
> -# the section and not the beginning of the function.
> +# When parse this object file using 'objdump', the references to the call
> +# sites are offsets from the section that the call site is in. Hence, all
> +# functions in a section that has a call site to mcount, will have the
^^
double space
> +# offset from the beginning of the section and not the beginning of the
> +# function.
> #
> -# The trick is to find a way to record the beginning of the section.
> -# The way we do this is to look at the first function in the section
> -# which will also be the location of that section after final link.
> +# But where this section will reside finally in vmlinx is undetermined at
> +# this point. So we can't use this kind of offsets to record the final
> +# address of this call site.
> +#
> +# The trick is to change the call offset refering the start of a section to
referring
> +# refering a function symbol in this section. During the link step, 'ld' will
referring
The rest looks good.
-- Steve
> +# compute the final address according to the information we record.
> +#
> # e.g.
> #
> # .section ".sched.text", "ax"
> -#
prev parent reply other threads:[~2009-10-27 20:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 6:54 Li Hong
2009-10-27 6:57 ` [PATCH 2/9] tracing: recordmcount.pl Correct the check on the number of parameters Li Hong
2009-10-30 16:19 ` [tip:tracing/core] tracing: Correct the check for number of arguments in recordmcount.pl tip-bot for Li Hong
2009-10-27 6:58 ` [PATCH 3/9] tracing: recordmcount.pl Support absolute path check on $inputfile Li Hong
2009-10-27 20:12 ` Steven Rostedt
2009-10-27 7:00 ` [PATCH 4/9] tracing: recordmcount.pl Objcopy check should disable local reference correctly Li Hong
2009-10-27 20:16 ` Steven Rostedt
2009-10-27 7:01 ` [PATCH 5/9] tracing: recordmcount.pl Clarify the logic on mcount section check Li Hong
2009-10-27 20:18 ` Steven Rostedt
2009-10-27 7:02 ` [PATCH 6/9] tracing: recordmcount.pl Exit early if no work to do Li Hong
2009-10-27 20:20 ` Steven Rostedt
2009-10-27 7:03 ` [PATCH 7/9] tracing: recordmcount.pl Combine the condition validation in update_funcs Li Hong
2009-10-27 20:22 ` Steven Rostedt
2009-10-27 7:04 ` [PATCH 8/9] tracing: recordmcount.pl We won't use weak function as reference, remove the check Li Hong
2009-10-27 20:25 ` Steven Rostedt
2009-10-27 7:05 ` [PATCH 9/9] tracing: recordmcount.pl Remove the redundant code Li Hong
2009-10-27 20:51 ` Steven Rostedt
2009-10-27 20:04 ` Steven Rostedt [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=1256673862.26028.430.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=lihong.hi@gmail.com \
--cc=linux-kernel@vger.kernel.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 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®