Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d75f054a authored by Helge Deller's avatar Helge Deller Committed by Kyle McMartin
Browse files

parisc: add ftrace (function and graph tracer) functionality



This patch adds the ftrace debugging functionality to the parisc kernel.
It will currently only work with 64bit kernels, because the gcc options -pg
and -ffunction-sections can't be enabled at the same time and -ffunction-sections
is still needed to be able to link 32bit kernels.

Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarKyle McMartin <kyle@mcmartin.ca>
parent 803094f4
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,9 @@ config PARISC
	def_bool y
	def_bool y
	select HAVE_IDE
	select HAVE_IDE
	select HAVE_OPROFILE
	select HAVE_OPROFILE
	select HAVE_FUNCTION_TRACER if 64BIT
	select HAVE_FUNCTION_GRAPH_TRACER if 64BIT
	select HAVE_FUNCTION_TRACE_MCOUNT_TEST if 64BIT
	select RTC_CLASS
	select RTC_CLASS
	select RTC_DRV_PARISC
	select RTC_DRV_PARISC
	select INIT_ALL_POSSIBLE
	select INIT_ALL_POSSIBLE
+3 −1
Original line number Original line Diff line number Diff line
@@ -56,7 +56,9 @@ cflags-y += -mdisable-fpregs


# Without this, "ld -r" results in .text sections that are too big
# Without this, "ld -r" results in .text sections that are too big
# (> 0x40000) for branches to reach stubs.
# (> 0x40000) for branches to reach stubs.
ifndef CONFIG_FUNCTION_TRACER
  cflags-y	+= -ffunction-sections
  cflags-y	+= -ffunction-sections
endif


# select which processor to optimise for
# select which processor to optimise for
cflags-$(CONFIG_PA7100)		+= -march=1.1 -mschedule=7100
cflags-$(CONFIG_PA7100)		+= -march=1.1 -mschedule=7100
+25 −0
Original line number Original line Diff line number Diff line
#ifndef _ASM_PARISC_FTRACE_H
#define _ASM_PARISC_FTRACE_H

#ifndef __ASSEMBLY__
extern void mcount(void);

/*
 * Stack of return addresses for functions of a thread.
 * Used in struct thread_info
 */
struct ftrace_ret_stack {
	unsigned long ret;
	unsigned long func;
	unsigned long long calltime;
};

/*
 * Primary handler of a function return.
 * It relays on ftrace_return_to_handler.
 * Defined in entry.S
 */
extern void return_to_handler(void);
#endif /* __ASSEMBLY__ */

#endif /* _ASM_PARISC_FTRACE_H */
+14 −0
Original line number Original line Diff line number Diff line
@@ -11,6 +11,18 @@ obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
		   process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \
		   process.o processor.o pdc_cons.o pdc_chassis.o unwind.o \
		   topology.o
		   topology.o


ifdef CONFIG_FUNCTION_TRACER
# Do not profile debug and lowlevel utilities
CFLAGS_REMOVE_ftrace.o = -pg
CFLAGS_REMOVE_cache.o = -pg
CFLAGS_REMOVE_irq.o = -pg
CFLAGS_REMOVE_pacache.o = -pg
CFLAGS_REMOVE_perf.o = -pg
CFLAGS_REMOVE_traps.o = -pg
CFLAGS_REMOVE_unaligned.o = -pg
CFLAGS_REMOVE_unwind.o = -pg
endif

obj-$(CONFIG_SMP)	+= smp.o
obj-$(CONFIG_SMP)	+= smp.o
obj-$(CONFIG_PA11)	+= pci-dma.o
obj-$(CONFIG_PA11)	+= pci-dma.o
obj-$(CONFIG_PCI)	+= pci.o
obj-$(CONFIG_PCI)	+= pci.o
@@ -19,3 +31,5 @@ obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o
obj-$(CONFIG_STACKTRACE)+= stacktrace.o
obj-$(CONFIG_STACKTRACE)+= stacktrace.o
# only supported for PCX-W/U in 64-bit mode at the moment
# only supported for PCX-W/U in 64-bit mode at the moment
obj-$(CONFIG_64BIT)	+= perf.o perf_asm.o
obj-$(CONFIG_64BIT)	+= perf.o perf_asm.o
obj-$(CONFIG_FUNCTION_TRACER)		+= ftrace.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER)	+= ftrace.o
+27 −0
Original line number Original line Diff line number Diff line
@@ -2185,6 +2185,33 @@ syscall_do_resched:
ENDPROC(syscall_exit)
ENDPROC(syscall_exit)




#ifdef CONFIG_FUNCTION_TRACER
	.import ftrace_function_trampoline,code
ENTRY(_mcount)
	copy	%r3, %arg2
	b	ftrace_function_trampoline
	nop
ENDPROC(_mcount)

ENTRY(return_to_handler)
	load32	return_trampoline, %rp
	copy	%ret0, %arg0
	copy	%ret1, %arg1
	b	ftrace_return_to_handler
	nop
return_trampoline:
	copy	%ret0, %rp
	copy	%r23, %ret0
	copy	%r24, %ret1

.globl ftrace_stub
ftrace_stub:
	bv	%r0(%rp)
	nop
ENDPROC(return_to_handler)
#endif	/* CONFIG_FUNCTION_TRACER */


get_register:
get_register:
	/*
	/*
	 * get_register is used by the non access tlb miss handlers to
	 * get_register is used by the non access tlb miss handlers to
Loading