Skip to content

Commit

Permalink
Merge branch 'tracing/ftrace' into tracing/urgent
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingo Molnar committed Oct 22, 2008
2 parents 2515ddc + 81520a1 commit debfcaf
Show file tree
Hide file tree
Showing 40 changed files with 113 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ KBUILD_CFLAGS += -g
KBUILD_AFLAGS += -gdwarf-2
endif

ifdef CONFIG_FTRACE
ifdef CONFIG_FUNCTION_TRACER
KBUILD_CFLAGS += -pg
endif

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ config ARM
select HAVE_ARCH_KGDB
select HAVE_KPROBES if (!XIP_KERNEL)
select HAVE_KRETPROBES if (HAVE_KPROBES)
select HAVE_FTRACE if (!XIP_KERNEL)
select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE)
select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
select HAVE_DYNAMIC_FTRACE if (HAVE_FUNCTION_TRACER)
select HAVE_GENERIC_DMA_COHERENT
help
The ARM series is a line of low-power-consumption RISC chip designs
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/boot/compressed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
targets := vmlinux vmlinux.lds piggy.gz piggy.o font.o font.c \
head.o misc.o $(OBJS)

ifeq ($(CONFIG_FTRACE),y)
ifeq ($(CONFIG_FUNCTION_TRACER),y)
ORIG_CFLAGS := $(KBUILD_CFLAGS)
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
endif
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/ftrace.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _ASM_ARM_FTRACE
#define _ASM_ARM_FTRACE

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#define MCOUNT_ADDR ((long)(mcount))
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/armksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,6 @@ EXPORT_SYMBOL(_find_next_bit_be);

EXPORT_SYMBOL(copy_page);

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
EXPORT_SYMBOL(mcount);
#endif
4 changes: 2 additions & 2 deletions arch/arm/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ENDPROC(ret_from_fork)
#undef CALL
#define CALL(x) .long x

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
ENTRY(mcount)
stmdb sp!, {r0-r3, lr}
Expand Down Expand Up @@ -149,7 +149,7 @@ trace:
ftrace_stub:
mov pc, lr

#endif /* CONFIG_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */

/*=============================================================================
* SWI handler
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ config PPC
bool
default y
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE
select HAVE_FUNCTION_TRACER
select ARCH_WANT_OPTIONAL_GPIOLIB
select HAVE_IDE
select HAVE_IOREMAP_PROT
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ KBUILD_CFLAGS += -mcpu=powerpc
endif

# Work around a gcc code-gen bug with -fno-omit-frame-pointer.
ifeq ($(CONFIG_FTRACE),y)
ifeq ($(CONFIG_FUNCTION_TRACER),y)
KBUILD_CFLAGS += -mno-sched-epilog
endif

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/ftrace.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _ASM_POWERPC_FTRACE
#define _ASM_POWERPC_FTRACE

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#define MCOUNT_ADDR ((long)(_mcount))
#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CFLAGS_prom_init.o += -fPIC
CFLAGS_btext.o += -fPIC
endif

ifdef CONFIG_FTRACE
ifdef CONFIG_FUNCTION_TRACER
# Do not trace early boot code
CFLAGS_REMOVE_cputable.o = -pg -mno-sched-epilog
CFLAGS_REMOVE_prom_init.o = -pg -mno-sched-epilog
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ machine_check_in_rtas:

#endif /* CONFIG_PPC_RTAS */

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
_GLOBAL(mcount)
_GLOBAL(_mcount)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ _GLOBAL(enter_prom)
mtlr r0
blr

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
_GLOBAL(mcount)
_GLOBAL(_mcount)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/ppc_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ EXPORT_SYMBOL(single_step_exception);
EXPORT_SYMBOL(sys_sigreturn);
#endif

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
EXPORT_SYMBOL(_mcount);
#endif

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powermac/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CFLAGS_bootx_init.o += -fPIC

ifdef CONFIG_FTRACE
ifdef CONFIG_FUNCTION_TRACER
# Do not trace early boot code
CFLAGS_REMOVE_bootx_init.o = -pg -mno-sched-epilog
endif
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ config SPARC64
bool
default y
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE
select HAVE_FUNCTION_TRACER
select HAVE_IDE
select HAVE_LMB
select HAVE_ARCH_KGDB
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc64/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ config DEBUG_PAGEALLOC

config MCOUNT
bool
depends on STACK_DEBUG || FTRACE
depends on STACK_DEBUG || FUNCTION_TRACER
default y

config FRAME_POINTER
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc64/lib/mcount.S
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ mcount:
nop
1:
#endif
#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
mov %o7, %o0
.globl mcount_call
Expand All @@ -119,7 +119,7 @@ mcount_call:
.size _mcount,.-_mcount
.size mcount,.-mcount

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
.globl ftrace_stub
.type ftrace_stub,#function
ftrace_stub:
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config X86
select HAVE_KRETPROBES
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE
select HAVE_FUNCTION_TRACER
select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
select HAVE_ARCH_KGDB if !X86_VOYAGER
select HAVE_ARCH_TRACEHOOK
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extra-y := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinu

CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)

ifdef CONFIG_FTRACE
ifdef CONFIG_FUNCTION_TRACER
# Do not profile debug and lowlevel utilities
CFLAGS_REMOVE_tsc.o = -pg
CFLAGS_REMOVE_rtc.o = -pg
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ ENDPROC(xen_failsafe_callback)

#endif /* CONFIG_XEN */

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE

ENTRY(mcount)
Expand Down Expand Up @@ -1204,7 +1204,7 @@ trace:
jmp ftrace_stub
END(mcount)
#endif /* CONFIG_DYNAMIC_FTRACE */
#endif /* CONFIG_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */

.section .rodata,"a"
#include "syscall_table_32.S"
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

.code64

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
ENTRY(mcount)
retq
Expand Down Expand Up @@ -138,7 +138,7 @@ trace:
jmp ftrace_stub
END(mcount)
#endif /* CONFIG_DYNAMIC_FTRACE */
#endif /* CONFIG_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */

#ifndef CONFIG_PREEMPT
#define retint_kernel retint_restore_args
Expand Down
6 changes: 4 additions & 2 deletions arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
unsigned char *new_code)
{
unsigned char replaced[MCOUNT_INSN_SIZE];
int ret;

/*
* Note: Due to modules and __init, code can
Expand All @@ -77,8 +78,9 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code,
if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0)
return 2;

WARN_ON_ONCE(__copy_to_user_inatomic((char __user *)ip, new_code,
MCOUNT_INSN_SIZE));
ret = __copy_to_user_inatomic((char __user *)ip, new_code,
MCOUNT_INSN_SIZE);
WARN_ON_ONCE(ret);

sync_core();

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/i386_ksyms_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <asm/desc.h>
#include <asm/ftrace.h>

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
/* mcount is defined in assembly */
EXPORT_SYMBOL(mcount);
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/x8664_ksyms_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <asm/desc.h>
#include <asm/ftrace.h>

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
/* mcount is defined in assembly */
EXPORT_SYMBOL(mcount);
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/xen/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ifdef CONFIG_FTRACE
ifdef CONFIG_FUNCTION_TRACER
# Do not profile debug and lowlevel utilities
CFLAGS_REMOVE_spinlock.o = -pg
CFLAGS_REMOVE_time.o = -pg
Expand Down
4 changes: 2 additions & 2 deletions include/asm-x86/ftrace.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ASM_X86__FTRACE_H
#define ASM_X86__FTRACE_H

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
#define MCOUNT_ADDR ((long)(mcount))
#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */

Expand All @@ -19,6 +19,6 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
}
#endif

#endif /* CONFIG_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */

#endif /* ASM_X86__FTRACE_H */
12 changes: 6 additions & 6 deletions include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <linux/types.h>
#include <linux/kallsyms.h>

#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER

extern int ftrace_enabled;
extern int
Expand Down Expand Up @@ -36,12 +36,12 @@ void clear_ftrace_function(void);

extern void ftrace_stub(unsigned long a0, unsigned long a1);

#else /* !CONFIG_FTRACE */
#else /* !CONFIG_FUNCTION_TRACER */
# define register_ftrace_function(ops) do { } while (0)
# define unregister_ftrace_function(ops) do { } while (0)
# define clear_ftrace_function(ops) do { } while (0)
static inline void ftrace_kill_atomic(void) { }
#endif /* CONFIG_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */

#ifdef CONFIG_DYNAMIC_FTRACE
# define FTRACE_HASHBITS 10
Expand Down Expand Up @@ -101,7 +101,7 @@ void ftrace_kill_atomic(void);

static inline void tracer_disable(void)
{
#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
ftrace_enabled = 0;
#endif
}
Expand All @@ -113,7 +113,7 @@ static inline void tracer_disable(void)
*/
static inline int __ftrace_enabled_save(void)
{
#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
int saved_ftrace_enabled = ftrace_enabled;
ftrace_enabled = 0;
return saved_ftrace_enabled;
Expand All @@ -124,7 +124,7 @@ static inline int __ftrace_enabled_save(void)

static inline void __ftrace_enabled_restore(int enabled)
{
#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
ftrace_enabled = enabled;
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o \

CFLAGS_REMOVE_sched.o = -mno-spe

ifdef CONFIG_FTRACE
ifdef CONFIG_FUNCTION_TRACER
# Do not trace debug files and internal ftrace files
CFLAGS_REMOVE_lockdep.o = -pg
CFLAGS_REMOVE_lockdep_proc.o = -pg
Expand Down Expand Up @@ -88,7 +88,7 @@ obj-$(CONFIG_MARKERS) += marker.o
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
obj-$(CONFIG_LATENCYTOP) += latencytop.o
obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
obj-$(CONFIG_FTRACE) += trace/
obj-$(CONFIG_FUNCTION_TRACER) += trace/
obj-$(CONFIG_TRACING) += trace/
obj-$(CONFIG_SMP) += sched_cpupri.o

Expand Down
2 changes: 1 addition & 1 deletion kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = &proc_dointvec,
},
#ifdef CONFIG_FTRACE
#ifdef CONFIG_FUNCTION_TRACER
{
.ctl_name = CTL_UNNUMBERED,
.procname = "ftrace_enabled",
Expand Down
Loading

0 comments on commit debfcaf

Please sign in to comment.