Archived
14
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
linux-2.6/arch/mips/kernel
Wu Zhangjin 7326c4e567 MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address
That thread "MIPS: Add option to pass return address location to
_mcount" from "David Daney <ddaney@caviumnetworks.com>" have added a new
option -mmcount-ra-address to gcc(4.5) for MIPS to transfer the location
of the return address to _mcount.

Benefit from this new feature, function graph tracer on MIPS will be
easier and safer to hijack the return address of the kernel function,
which will save some overhead and make the whole thing more reliable.

In this patch, at first, try to enable the option -mmcount-ra-address in
arch/mips/Makefile with cc-option, if gcc support it, it will be
enabled, otherwise, no side effect.

and then, we need to support this new option of gcc 4.5 and also support
the old gcc versions.

with _mcount in the old gcc versions, it's not easy to get the location
of return address(tracing: add function graph tracer support for MIPS),
   so, we do it in a C function: ftrace_get_parent_addr(ftrace.c), but
   with -mmcount-ra-address, only several instructions need to get what
   we want, so, I put into asm(mcount.S). and also, as the $12(t0) is
   used by -mmcount-ra-address for transferring the localtion of return
   address to _mcount, we need to save it into the stack and restore it
   when enabled dynamic function tracer, 'Cause we have called
   "ftrace_call" before "ftrace_graph_caller", which may destroy
   $12(t0).

(Thanks to David for providing that -mcount-ra-address and giving the
 idea of KBUILD_MCOUNT_RA_ADDRESS, both of them have made the whole
 thing more beautiful!)

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Nicholas Mc Guire <der.herr@hofr.at>
Cc: zhangfx@lemote.com
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/681/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2009-12-17 01:57:27 +00:00
..
cpufreq MIPS: Loongson 2F: Add CPU frequency scaling support 2009-12-17 01:57:20 +00:00
.gitignore
8250-platform.c
asm-offsets.c MIPS: Use PAGE_SIZE in assembly instead of _PAGE_SIZE. 2009-09-17 20:07:48 +02:00
binfmt_elfn32.c
binfmt_elfo32.c MIPS: 64-bit: Fix o32 core dump 2009-07-03 15:45:27 +01:00
branch.c
cevt-bcm1480.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
cevt-ds1287.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
cevt-gt641xx.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
cevt-r4k.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
cevt-sb1250.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
cevt-smtc.c MIPS: SMTC: Fix lockup in smtc_distribute_timer 2009-11-13 18:10:38 +01:00
cevt-txx9.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
cpu-bugs64.c MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
cpu-probe.c MIPS: Loongson 2F: Add CPU frequency scaling support 2009-12-17 01:57:20 +00:00
csrc-bcm1480.c clocksource: pass clocksource to read() callback 2009-04-21 13:41:47 -07:00
csrc-ioasic.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
csrc-powertv.c MIPS: PowerTV: Base files for Cisco PowerTV platform 2009-12-17 01:57:17 +00:00
csrc-r4k.c clocksource: pass clocksource to read() callback 2009-04-21 13:41:47 -07:00
csrc-sb1250.c clocksource: pass clocksource to read() callback 2009-04-21 13:41:47 -07:00
early_printk.c
entry.S
ftrace.c MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address 2009-12-17 01:57:27 +00:00
genex.S
gpio_txx9.c
head.S MIPS: Avoid potential hazard on Context register 2009-11-02 12:00:07 +01:00
i8253.c MIPS: Add IRQF_TIMER flag for timer interrupts 2009-11-02 12:00:02 +01:00
i8259.c cpumask: remove references to struct irqaction's mask field. 2009-03-30 22:05:14 +10:30
init_task.c Use new __init_task_data macro in arch init_task.c files. 2009-09-21 06:27:08 +02:00
irq-gic.c MIPS: GIC: Random fixes and enhancements. 2009-11-02 12:00:06 +01:00
irq-gt641xx.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
irq-msc01.c MIPS: Enable GENERIC_HARDIRQS_NO__DO_IRQ for all platforms 2009-03-30 14:49:44 +02:00
irq-rm7000.c
irq-rm9000.c
irq.c MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS 2009-12-17 01:57:24 +00:00
irq_cpu.c MIPS: Enable GENERIC_HARDIRQS_NO__DO_IRQ for all platforms 2009-03-30 14:49:44 +02:00
irq_txx9.c MIPS: Eleminate filenames from comments 2009-08-03 17:52:40 +01:00
kgdb.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
kspd.c vfs: Implement proper O_SYNC semantics 2009-12-10 15:02:50 +01:00
linux32.c Unify sys_mmap* 2009-12-11 06:44:29 -05:00
machine_kexec.c
Makefile MIPS: Tracing: Add dynamic function tracer support 2009-12-17 01:57:23 +00:00
mcount.S MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address 2009-12-17 01:57:27 +00:00
mips-mt-fpaff.c MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
mips-mt.c MIPS: Remove useless zero initializations. 2009-09-17 20:07:51 +02:00
mips_ksyms.c MIPS: Tracing: Add static function tracer support for MIPS 2009-12-17 01:57:21 +00:00
module.c MIPS: Module: Make error messages unique. 2009-08-03 17:52:48 +01:00
octeon_switch.S MIPS: Consolidate all CONFIG_CPU_HAS_LLSC use in a single C file. 2009-09-17 20:07:49 +02:00
proc.c MIPS: Eleminate filenames from comments 2009-08-03 17:52:40 +01:00
process.c MIPS: Avoid clobbering struct pt_regs in kthreads 2009-08-03 17:52:41 +01:00
ptrace.c
ptrace32.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
r4k_fpu.S
r4k_switch.S MIPS: Consolidate all CONFIG_CPU_HAS_LLSC use in a single C file. 2009-09-17 20:07:49 +02:00
r2300_fpu.S
r2300_switch.S MIPS: Consolidate all CONFIG_CPU_HAS_LLSC use in a single C file. 2009-09-17 20:07:49 +02:00
r6000_fpu.S
relocate_kernel.S
reset.c
rtlx.c MIPS: VPE: Get rid of BKL. 2009-09-30 21:47:02 +02:00
scall32-o32.S net: Introduce recvmmsg socket syscall 2009-10-12 23:40:10 -07:00
scall64-64.S net: Introduce recvmmsg socket syscall 2009-10-12 23:40:10 -07:00
scall64-n32.S Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-12-08 07:55:01 -08:00
scall64-o32.S Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-12-08 07:55:01 -08:00
setup.c MIPS: Remove addinitrd and CONFIG_PROBE_INITRD_HEADER 2009-12-17 01:57:07 +00:00
signal-common.h
signal.c KEYS: Add missing linux/tracehook.h #inclusions 2009-09-09 18:30:02 +10:00
signal32.c
signal_n32.c
smp-cmp.c cpumask: Use accessors for cpu_*_mask: mips 2009-09-24 09:34:48 +09:30
smp-mt.c cpumask: Use accessors for cpu_*_mask: mips 2009-09-24 09:34:48 +09:30
smp-up.c cpumask: arch_send_call_function_ipi_mask: mips 2009-09-24 09:34:45 +09:30
smp.c MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS 2009-12-17 01:57:24 +00:00
smtc-asm.S
smtc-proc.c
smtc.c MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS 2009-12-17 01:57:24 +00:00
spram.c MIPS: SPRAM: Clean up support code a little 2009-11-02 12:00:05 +01:00
stacktrace.c MIPS: Eleminate filenames from comments 2009-08-03 17:52:40 +01:00
sync-r4k.c MIPS: CMP: Update sync-r4k for current kernel 2009-07-03 15:45:27 +01:00
syscall.c fix broken aliasing checks for MAP_FIXED on sparc32, mips, arm and sh 2009-12-11 06:44:59 -05:00
time.c mips: Use generic mult/shift factor calculation for clocks 2009-11-13 20:46:24 +01:00
topology.c MIPS: Add arch generic CPU hotplug 2009-06-24 18:34:40 +01:00
traps.c MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler 2009-09-17 20:07:49 +02:00
unaligned.c MIPS: Use force_sig when handling address errors. 2009-05-14 13:50:29 +01:00
vmlinux.lds.S MIPS: Tracing: Add IRQENTRY_EXIT section for MIPS 2009-12-17 01:57:24 +00:00
vpe.c MIPS: VPE: Remove stray unlock_kernel. 2009-11-02 12:00:02 +01:00
watch.c