Skip to content

Commit 2464a60

Browse files
author
Ingo Molnar
committed
ftrace: do not trace library functions
make function tracing more robust: do not trace library functions. We've already got a sizable list of exceptions: ifdef CONFIG_FTRACE # Do not profile string.o, since it may be used in early boot or vdso CFLAGS_REMOVE_string.o = -pg # Also do not profile any debug utilities CFLAGS_REMOVE_spinlock_debug.o = -pg CFLAGS_REMOVE_list_debug.o = -pg CFLAGS_REMOVE_debugobjects.o = -pg CFLAGS_REMOVE_find_next_bit.o = -pg CFLAGS_REMOVE_cpumask.o = -pg CFLAGS_REMOVE_bitmap.o = -pg endif ... and the pattern has been that random library functionality showed up in ftrace's critical path (outside of its recursion check), causing hard to debug lockups. So be a bit defensive about it and exclude all lib/*.o functions by default. It's not that they are overly interesting for tracing purposes anyway. Specific ones can still be traced, in an opt-in manner. Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent c349e0a commit 2464a60

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

‎lib/Makefile‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,17 @@
22
# Makefile for some libs needed in the kernel.
33
#
44

5+
ifdef CONFIG_FTRACE
6+
ORIG_CFLAGS := $(KBUILD_CFLAGS)
7+
KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
8+
endif
9+
510
lib-y := ctype.o string.o vsprintf.o cmdline.o \
611
rbtree.o radix-tree.o dump_stack.o \
712
idr.o int_sqrt.o extable.o prio_tree.o \
813
sha1.o irq_regs.o reciprocal_div.o argv_split.o \
914
proportions.o prio_heap.o ratelimit.o
1015

11-
ifdef CONFIG_FTRACE
12-
# Do not profile string.o, since it may be used in early boot or vdso
13-
CFLAGS_REMOVE_string.o = -pg
14-
# Also do not profile any debug utilities
15-
CFLAGS_REMOVE_spinlock_debug.o = -pg
16-
CFLAGS_REMOVE_list_debug.o = -pg
17-
CFLAGS_REMOVE_debugobjects.o = -pg
18-
CFLAGS_REMOVE_find_next_bit.o = -pg
19-
CFLAGS_REMOVE_cpumask.o = -pg
20-
CFLAGS_REMOVE_bitmap.o = -pg
21-
endif
22-
2316
lib-$(CONFIG_MMU) += ioremap.o
2417
lib-$(CONFIG_SMP) += cpumask.o
2518

0 commit comments

Comments
 (0)