<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/scripts/recordmcount.pl, branch v2.6.38</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.38</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.38'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2010-09-02T14:28:43Z</updated>
<entry>
<title>ARM: 6319/1: ftrace: add Thumb-2 support to dynamic ftrace</title>
<updated>2010-09-02T14:28:43Z</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2010-08-10T18:52:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=72dc43a9eb123d2742bd413c80dbeab0c588f622'/>
<id>urn:sha1:72dc43a9eb123d2742bd413c80dbeab0c588f622</id>
<content type='text'>
Handle the different nop and call instructions for Thumb-2.  Also, we
need to adjust the recorded mcount_loc addresses because they have the
lsb set.

Cc: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt; [recordmcount.pl change]
Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ARM: 6318/1: ftrace: fix and update dynamic ftrace</title>
<updated>2010-09-02T14:27:40Z</updated>
<author>
<name>Rabin Vincent</name>
<email>rabin@rab.in</email>
</author>
<published>2010-08-10T18:43:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3b6c223b1b97ad60bbb0f4efda57d649414ac2a2'/>
<id>urn:sha1:3b6c223b1b97ad60bbb0f4efda57d649414ac2a2</id>
<content type='text'>
This adds mcount recording and updates dynamic ftrace for ARM to work
with the new ftrace dyamic tracing implementation.  It also adds support
for the mcount format used by newer ARM compilers.

With dynamic tracing, mcount() is implemented as a nop.  Callsites are
patched on startup with nops, and dynamically patched to call to the
ftrace_caller() routine as needed.

Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt; [recordmcount.pl change]
Signed-off-by: Rabin Vincent &lt;rabin@rab.in&gt;
Signed-off-by: Russell King &lt;rmk+kernel@arm.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tip/perf/urgent-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into trace/tip/perf/urgent-4</title>
<updated>2010-08-16T15:17:30Z</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2010-08-16T15:17:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d244b6bd41e09ecbb09c738cc2c108be227398c8'/>
<id>urn:sha1:d244b6bd41e09ecbb09c738cc2c108be227398c8</id>
<content type='text'>
Conflicts:
	kernel/trace/trace_events.c

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Extend recordmcount to better support Blackfin mcount</title>
<updated>2010-08-12T14:06:51Z</updated>
<author>
<name>Mike Frysinger</name>
<email>vapier@gentoo.org</email>
</author>
<published>2010-08-06T07:26:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=465c6cca2668a2db2a4ffce3dca5714017873f2b'/>
<id>urn:sha1:465c6cca2668a2db2a4ffce3dca5714017873f2b</id>
<content type='text'>
The mcount call on Blackfin systems includes some stack manipulation
around the actual call site, so extend the build time perl script to
support this.  This way we can avoid doing the calculation at runtime.

Signed-off-by: Mike Frysinger &lt;vapier@gentoo.org&gt;
LKML-Reference: &lt;1281079584-21205-1-git-send-email-vapier@gentoo.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Fix $mcount_regex for MIPS in recordmcount.pl</title>
<updated>2010-07-22T18:55:43Z</updated>
<author>
<name>David Daney</name>
<email>ddaney@caviumnetworks.com</email>
</author>
<published>2010-07-09T21:52:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a484e54fae891703cbe1c9ec1b536605f11f5482'/>
<id>urn:sha1:a484e54fae891703cbe1c9ec1b536605f11f5482</id>
<content type='text'>
I found this issue in a locally patched 2.6.32.x, current kernels have
moved the offending code to an __init function which is skipped by
recordmcount.pl, so the bug is not currently being exercised.
However, I think the patch is still a good idea, to avoid future
problems if _mcount were to ever have its address taken in normal
code.

This is what I originally saw:

    Although arch/mips/kernel/ftrace.c is built without -pg, and thus
    contains no calls to _mcount, it does use the address of _mcount
    in ftrace_make_nop().  This was causing relocations to be emitted
    for _mcount which recordmcount.pl erronously took to be _mcount
    call sites.  The result was that the text of ftrace_make_nop()
    would be patched with garbage leading to a system crash.

In non-module code, all _mcount call sites will have R_MIPS_26
relocations, so we restrict $mcount_regex to only match on these.

Acked-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
Acked-by: Wu Zhangjin &lt;wuzhangjin@gmail.com&gt;
Signed-off-by: David Daney &lt;ddaney@caviumnetworks.com&gt;
LKML-Reference: &lt;1278712325-12050-1-git-send-email-ddaney@caviumnetworks.com&gt;
Cc: Li Hong &lt;lihong.hi@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Matt Fleming &lt;matt@console-pimps.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Merge commit 'v2.6.33' into tracing/core</title>
<updated>2010-02-26T08:18:32Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2010-02-26T08:18:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=64b9fb5704a479d98a59f2a1d45d3331a8f847f8'/>
<id>urn:sha1:64b9fb5704a479d98a59f2a1d45d3331a8f847f8</id>
<content type='text'>
Conflicts:
	scripts/recordmcount.pl

Merge reason: Merge up to v2.6.33.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>tracing/x86: Derive arch from bits argument in recordmcount.pl</title>
<updated>2010-01-12T04:49:35Z</updated>
<author>
<name>Jan Kiszka</name>
<email>jan.kiszka@siemens.com</email>
</author>
<published>2010-01-11T10:31:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b82a4045f7962483a78a874343dc6e31b79c96c1'/>
<id>urn:sha1:b82a4045f7962483a78a874343dc6e31b79c96c1</id>
<content type='text'>
Let the arch argument be overruled by bits. Otherwise, building of
external modules against a i386 target on a x86-64 host (and likely vice
versa as well) fails unless ARCH=i386 is explicitly passed to make.

Signed-off-by: Jan Kiszka &lt;jan.kiszka@siemens.com&gt;
LKML-Reference: &lt;4B4AFE10.8050109@siemens.com&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Use appropriate perl constructs in recordmcount.pl</title>
<updated>2010-01-06T23:08:58Z</updated>
<author>
<name>Wolfram Sang</name>
<email>w.sang@pengutronix.de</email>
</author>
<published>2010-01-05T20:41:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dfaa9e2c5707b2c217c0121aac796e0fa3051482'/>
<id>urn:sha1:dfaa9e2c5707b2c217c0121aac796e0fa3051482</id>
<content type='text'>
Modified recordmcount.pl to use perl constructs that are still
understandable by C hackers that are not perl programmers.

Signed-off-by: Wolfram Sang &lt;w.sang@pengutronix.de&gt;
LKML-Reference: &lt;1262724082-9517-1-git-send-email-w.sang@pengutronix.de&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: optimize recordmcount.pl for offsets-handling</title>
<updated>2010-01-06T18:32:39Z</updated>
<author>
<name>Wolfram Sang</name>
<email>w.sang@pengutronix.de</email>
</author>
<published>2010-01-05T18:27:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dc4f8845ee2ca39fe054a2d911729ffd269b4b66'/>
<id>urn:sha1:dc4f8845ee2ca39fe054a2d911729ffd269b4b66</id>
<content type='text'>
- move check for open file in front of the writing loop
- use perl-constructs to access the array

Signed-off-by: Wolfram Sang &lt;w.sang@pengutronix.de&gt;
LKML-Reference: &lt;1262716072-14414-2-git-send-email-w.sang@pengutronix.de&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>MIPS: Tracing: Add dynamic function tracer support</title>
<updated>2009-12-17T01:57:23Z</updated>
<author>
<name>Wu Zhangjin</name>
<email>wuzhangjin@gmail.com</email>
</author>
<published>2009-11-20T12:34:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=538f19526e40ce7a5a296fad6a3121409c890adc'/>
<id>urn:sha1:538f19526e40ce7a5a296fad6a3121409c890adc</id>
<content type='text'>
With dynamic function tracer, by default, _mcount is defined as an
"empty" function, it returns directly without any more action . When
enabling it in user-space, it will jump to a real tracing
function(ftrace_caller), and do the real job for us.

Differ from the static function tracer, dynamic function tracer provides
two functions ftrace_make_call()/ftrace_make_nop() to enable/disable the
tracing of some indicated kernel functions(set_ftrace_filter).

In the -v4 version, the implementation of this support is basically the same as
X86 version does: _mcount is implemented as an empty function and ftrace_caller
is implemented as a real tracing function respectively.

But in this version, to support module tracing with the help of
-mlong-calls in arch/mips/Makefile:

MODFLAGS += -mlong-calls.

The stuff becomes a little more complex. We need to cope with two
different type of calling to _mcount.

For the kernel part, the calling to _mcount(result of "objdump -hdr
vmlinux"). is like this:

	108:   03e0082d        move    at,ra
	10c:   0c000000        jal     0 &lt;fpcsr_pending&gt;
                        10c: R_MIPS_26  _mcount
                        10c: R_MIPS_NONE        *ABS*
                        10c: R_MIPS_NONE        *ABS*
	110:   00020021        nop

For the module with -mlong-calls, it looks like this:

	c:	3c030000 	lui	v1,0x0
			c: R_MIPS_HI16	_mcount
			c: R_MIPS_NONE	*ABS*
			c: R_MIPS_NONE	*ABS*
	10:	64630000 	daddiu	v1,v1,0
			10: R_MIPS_LO16	_mcount
			10: R_MIPS_NONE	*ABS*
			10: R_MIPS_NONE	*ABS*
	14:	03e0082d 	move	at,ra
	18:	0060f809 	jalr	v1

In the kernel version, there is only one "_mcount" string for every
kernel function, so, we just need to match this one in mcount_regex of
scripts/recordmcount.pl, but in the module version, we need to choose
one of the two to match. Herein, I choose the first one with
"R_MIPS_HI16 _mcount".

and In the kernel verion, without module tracing support, we just need
to replace "jal _mcount" by "jal ftrace_caller" to do real tracing, and
filter the tracing of some kernel functions via replacing it by a nop
instruction.

but as we have described before, the instruction "jal ftrace_caller" only left
32bit length for the address of ftrace_caller, it will fail when calling from
the module space. so, herein, we must replace something else.

the basic idea is loading the address of ftrace_caller to v1 via changing these
two instructions:

	lui	v1,0x0
	addiu	v1,v1,0

If we want to enable the tracing, we need to replace the above instructions to:

	lui	v1, HI_16BIT_ftrace_caller
	addiu	v1, v1, LOW_16BIT_ftrace_caller

If we want to stop the tracing of the indicated kernel functions, we
just need to replace the "jalr v1" to a nop instruction. but we need to
replace two instructions and encode the above two instructions
oursevles.

Is there a simpler solution? Yes! Here it is, in this version, we put _mcount
and ftrace_caller together, which means the address of _mcount and
ftrace_caller is the same:

_mcount:
ftrace_caller:
	j	ftrace_stub
	 nop

	...(do real tracing here)...

ftrace_stub:
	jr	ra
	 move	ra, at

By default, the kernel functions call _mcount, and then jump to ftrace_stub and
return. and when we want to do real tracing, we just need to remove that "j
ftrace_stub", and it will run through the two "nop" instructions and then do
the real tracing job.

what about filtering job? we just need to do this:

	 lui v1, hi_16bit_of_mcount        &lt;--&gt; b 1f (0x10000004)
	 addiu v1, v1, low_16bit_of_mcount
	 move at, ra
	 jalr v1
	 nop
	 				     1f: (rec-&gt;ip + 12)

In linux-mips64, there will be some local symbols, whose name are
prefixed by $L, which need to be filtered. thanks goes to Steven for
writing the mips64-specific function_regex.

In a conclusion, with RISC, things becomes easier with such a "stupid"
trick, RISC is something like K.I.S.S, and also, there are lots of
"simple" tricks in the whole ftrace support, thanks goes to Steven and
the other folks for providing such a wonderful tracing framework!

Signed-off-by: Wu Zhangjin &lt;wuzhangjin@gmail.com&gt;
Cc: Nicholas Mc Guire &lt;der.herr@hofr.at&gt;
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin &lt;wuzhangjin@gmail.com&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/675/
Acked-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
</content>
</entry>
</feed>
