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: Michal Simek <monstr@monstr.eu>

+13 -4
+1
arch/microblaze/kernel/Makefile
··· 10 CFLAGS_REMOVE_selfmod.o = -pg 11 CFLAGS_REMOVE_heartbeat.o = -pg 12 CFLAGS_REMOVE_ftrace.o = -pg 13 endif 14 15 extra-y := head.o vmlinux.lds
··· 10 CFLAGS_REMOVE_selfmod.o = -pg 11 CFLAGS_REMOVE_heartbeat.o = -pg 12 CFLAGS_REMOVE_ftrace.o = -pg 13 + CFLAGS_REMOVE_process.o = -pg 14 endif 15 16 extra-y := head.o vmlinux.lds
+6 -4
arch/microblaze/kernel/ftrace.c
··· 51 : "r" (parent), "r" (return_hooker) 52 ); 53 54 if (unlikely(faulted)) { 55 ftrace_graph_stop(); 56 WARN_ON(1); ··· 97 98 if (unlikely(faulted)) 99 return -EFAULT; 100 101 return 0; 102 } ··· 201 ret += ftrace_modify_code((unsigned long)&ftrace_caller, 202 MICROBLAZE_NOP); 203 204 - /* All changes are done - lets do caches consistent */ 205 - flush_icache(); 206 return ret; 207 } 208 ··· 214 215 old_jump = *(unsigned int *)ip; /* save jump over instruction */ 216 ret = ftrace_modify_code(ip, MICROBLAZE_NOP); 217 - flush_icache(); 218 219 pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump); 220 return ret; ··· 225 unsigned long ip = (unsigned long)(&ftrace_call_graph); 226 227 ret = ftrace_modify_code(ip, old_jump); 228 - flush_icache(); 229 230 pr_debug("%s\n", __func__); 231 return ret;
··· 51 : "r" (parent), "r" (return_hooker) 52 ); 53 54 + flush_dcache_range((u32)parent, (u32)parent + 4); 55 + flush_icache_range((u32)parent, (u32)parent + 4); 56 + 57 if (unlikely(faulted)) { 58 ftrace_graph_stop(); 59 WARN_ON(1); ··· 94 95 if (unlikely(faulted)) 96 return -EFAULT; 97 + 98 + flush_dcache_range(addr, addr + 4); 99 + flush_icache_range(addr, addr + 4); 100 101 return 0; 102 } ··· 195 ret += ftrace_modify_code((unsigned long)&ftrace_caller, 196 MICROBLAZE_NOP); 197 198 return ret; 199 } 200 ··· 210 211 old_jump = *(unsigned int *)ip; /* save jump over instruction */ 212 ret = ftrace_modify_code(ip, MICROBLAZE_NOP); 213 214 pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump); 215 return ret; ··· 222 unsigned long ip = (unsigned long)(&ftrace_call_graph); 223 224 ret = ftrace_modify_code(ip, old_jump); 225 226 pr_debug("%s\n", __func__); 227 return ret;
+6
arch/microblaze/lib/Makefile
··· 2 # Makefile 3 # 4 5 lib-y := memset.o 6 7 ifeq ($(CONFIG_OPT_LIB_ASM),y)
··· 2 # Makefile 3 # 4 5 + ifdef CONFIG_FUNCTION_TRACER 6 + CFLAGS_REMOVE_ashldi3.o = -pg 7 + CFLAGS_REMOVE_ashrdi3.o = -pg 8 + CFLAGS_REMOVE_lshrdi3.o = -pg 9 + endif 10 + 11 lib-y := memset.o 12 13 ifeq ($(CONFIG_OPT_LIB_ASM),y)