提交 9e1491de 编写于 作者: M Michal Simek

microblaze: Fix ftrace

- Do not trace idle loop which takes a lot time
- Fix cache handling in generic ftrace code
- Do not trace lib functions ashldi3, ashrdi3, lshrdi3
  Functions are called from generic ftrace code which
  can't be traced
Signed-off-by: NMichal Simek <monstr@monstr.eu>
上级 57bd35d4
...@@ -10,6 +10,7 @@ CFLAGS_REMOVE_early_printk.o = -pg ...@@ -10,6 +10,7 @@ CFLAGS_REMOVE_early_printk.o = -pg
CFLAGS_REMOVE_selfmod.o = -pg CFLAGS_REMOVE_selfmod.o = -pg
CFLAGS_REMOVE_heartbeat.o = -pg CFLAGS_REMOVE_heartbeat.o = -pg
CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_ftrace.o = -pg
CFLAGS_REMOVE_process.o = -pg
endif endif
extra-y := head.o vmlinux.lds extra-y := head.o vmlinux.lds
......
...@@ -51,6 +51,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) ...@@ -51,6 +51,9 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
: "r" (parent), "r" (return_hooker) : "r" (parent), "r" (return_hooker)
); );
flush_dcache_range((u32)parent, (u32)parent + 4);
flush_icache_range((u32)parent, (u32)parent + 4);
if (unlikely(faulted)) { if (unlikely(faulted)) {
ftrace_graph_stop(); ftrace_graph_stop();
WARN_ON(1); WARN_ON(1);
...@@ -95,6 +98,9 @@ static int ftrace_modify_code(unsigned long addr, unsigned int value) ...@@ -95,6 +98,9 @@ static int ftrace_modify_code(unsigned long addr, unsigned int value)
if (unlikely(faulted)) if (unlikely(faulted))
return -EFAULT; return -EFAULT;
flush_dcache_range(addr, addr + 4);
flush_icache_range(addr, addr + 4);
return 0; return 0;
} }
...@@ -195,8 +201,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func) ...@@ -195,8 +201,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
ret += ftrace_modify_code((unsigned long)&ftrace_caller, ret += ftrace_modify_code((unsigned long)&ftrace_caller,
MICROBLAZE_NOP); MICROBLAZE_NOP);
/* All changes are done - lets do caches consistent */
flush_icache();
return ret; return ret;
} }
...@@ -210,7 +214,6 @@ int ftrace_enable_ftrace_graph_caller(void) ...@@ -210,7 +214,6 @@ int ftrace_enable_ftrace_graph_caller(void)
old_jump = *(unsigned int *)ip; /* save jump over instruction */ old_jump = *(unsigned int *)ip; /* save jump over instruction */
ret = ftrace_modify_code(ip, MICROBLAZE_NOP); ret = ftrace_modify_code(ip, MICROBLAZE_NOP);
flush_icache();
pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump); pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump);
return ret; return ret;
...@@ -222,7 +225,6 @@ int ftrace_disable_ftrace_graph_caller(void) ...@@ -222,7 +225,6 @@ int ftrace_disable_ftrace_graph_caller(void)
unsigned long ip = (unsigned long)(&ftrace_call_graph); unsigned long ip = (unsigned long)(&ftrace_call_graph);
ret = ftrace_modify_code(ip, old_jump); ret = ftrace_modify_code(ip, old_jump);
flush_icache();
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
return ret; return ret;
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
# Makefile # Makefile
# #
ifdef CONFIG_FUNCTION_TRACER
CFLAGS_REMOVE_ashldi3.o = -pg
CFLAGS_REMOVE_ashrdi3.o = -pg
CFLAGS_REMOVE_lshrdi3.o = -pg
endif
lib-y := memset.o lib-y := memset.o
ifeq ($(CONFIG_OPT_LIB_ASM),y) ifeq ($(CONFIG_OPT_LIB_ASM),y)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册