aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/vdso/vclock_gettime.c2
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/linux/compiler.h19
-rw-r--r--kernel/trace/Kconfig10
-rw-r--r--kernel/trace/Makefile7
-rw-r--r--kernel/trace/trace.c2
-rw-r--r--kernel/trace/trace.h6
-rw-r--r--kernel/trace/trace_unlikely.c4
9 files changed, 27 insertions, 27 deletions
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index ece02932ea57..6f3d3d4cd973 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20/* Disable profiling for userspace code: */ 20/* Disable profiling for userspace code: */
21#define DISABLE_UNLIKELY_PROFILE 21#define DISABLE_BRANCH_PROFILING
22 22
23#include <linux/time.h> 23#include <linux/time.h>
24#include <linux/init.h> 24#include <linux/init.h>
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 6e667631e7dc..d9d35824c56f 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/* Disable profiling for userspace code: */ 12/* Disable profiling for userspace code: */
13#define DISABLE_UNLIKELY_PROFILE 13#define DISABLE_BRANCH_PROFILING
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/posix-timers.h> 16#include <linux/posix-timers.h>
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index e10beb5335c9..a5e4ed9baec8 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -45,7 +45,7 @@
45#define MCOUNT_REC() 45#define MCOUNT_REC()
46#endif 46#endif
47 47
48#ifdef CONFIG_TRACE_UNLIKELY_PROFILE 48#ifdef CONFIG_TRACE_BRANCH_PROFILING
49#define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_likely_profile) = .; \ 49#define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_likely_profile) = .; \
50 *(_ftrace_likely) \ 50 *(_ftrace_likely) \
51 VMLINUX_SYMBOL(__stop_likely_profile) = .; \ 51 VMLINUX_SYMBOL(__stop_likely_profile) = .; \
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 63b7d9089d6e..c7d804a7a4d6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -59,26 +59,27 @@ extern void __chk_io_ptr(const volatile void __iomem *);
59 * specific implementations come from the above header files 59 * specific implementations come from the above header files
60 */ 60 */
61 61
62/* 62struct ftrace_branch_data {
63 * Note: DISABLE_UNLIKELY_PROFILE can be used by special lowlevel code
64 * to disable branch tracing on a per file basis.
65 */
66#if defined(CONFIG_TRACE_UNLIKELY_PROFILE) && !defined(DISABLE_UNLIKELY_PROFILE)
67struct ftrace_likely_data {
68 const char *func; 63 const char *func;
69 const char *file; 64 const char *file;
70 unsigned line; 65 unsigned line;
71 unsigned long correct; 66 unsigned long correct;
72 unsigned long incorrect; 67 unsigned long incorrect;
73}; 68};
74void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect); 69
70/*
71 * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
72 * to disable branch tracing on a per file basis.
73 */
74#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
75void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
75 76
76#define likely_notrace(x) __builtin_expect(!!(x), 1) 77#define likely_notrace(x) __builtin_expect(!!(x), 1)
77#define unlikely_notrace(x) __builtin_expect(!!(x), 0) 78#define unlikely_notrace(x) __builtin_expect(!!(x), 0)
78 79
79#define likely_check(x) ({ \ 80#define likely_check(x) ({ \
80 int ______r; \ 81 int ______r; \
81 static struct ftrace_likely_data \ 82 static struct ftrace_branch_data \
82 __attribute__((__aligned__(4))) \ 83 __attribute__((__aligned__(4))) \
83 __attribute__((section("_ftrace_likely"))) \ 84 __attribute__((section("_ftrace_likely"))) \
84 ______f = { \ 85 ______f = { \
@@ -93,7 +94,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect);
93 }) 94 })
94#define unlikely_check(x) ({ \ 95#define unlikely_check(x) ({ \
95 int ______r; \ 96 int ______r; \
96 static struct ftrace_likely_data \ 97 static struct ftrace_branch_data \
97 __attribute__((__aligned__(4))) \ 98 __attribute__((__aligned__(4))) \
98 __attribute__((section("_ftrace_unlikely"))) \ 99 __attribute__((section("_ftrace_unlikely"))) \
99 ______f = { \ 100 ______f = { \
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 8abcaf821beb..9c89526b6b7c 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -159,7 +159,7 @@ config BOOT_TRACER
159 selected, because the self-tests are an initcall as well and that 159 selected, because the self-tests are an initcall as well and that
160 would invalidate the boot trace. ) 160 would invalidate the boot trace. )
161 161
162config TRACE_UNLIKELY_PROFILE 162config TRACE_BRANCH_PROFILING
163 bool "Trace likely/unlikely profiler" 163 bool "Trace likely/unlikely profiler"
164 depends on DEBUG_KERNEL 164 depends on DEBUG_KERNEL
165 select TRACING 165 select TRACING
@@ -175,7 +175,7 @@ config TRACE_UNLIKELY_PROFILE
175 175
176 Say N if unsure. 176 Say N if unsure.
177 177
178config TRACING_UNLIKELY 178config TRACING_BRANCHES
179 bool 179 bool
180 help 180 help
181 Selected by tracers that will trace the likely and unlikely 181 Selected by tracers that will trace the likely and unlikely
@@ -183,10 +183,10 @@ config TRACING_UNLIKELY
183 profiled. Profiling the tracing infrastructure can only happen 183 profiled. Profiling the tracing infrastructure can only happen
184 when the likelys and unlikelys are not being traced. 184 when the likelys and unlikelys are not being traced.
185 185
186config UNLIKELY_TRACER 186config BRANCH_TRACER
187 bool "Trace likely/unlikely instances" 187 bool "Trace likely/unlikely instances"
188 depends on TRACE_UNLIKELY_PROFILE 188 depends on TRACE_BRANCH_PROFILING
189 select TRACING_UNLIKELY 189 select TRACING_BRANCHES
190 help 190 help
191 This traces the events of likely and unlikely condition 191 This traces the events of likely and unlikely condition
192 calls in the kernel. The difference between this and the 192 calls in the kernel. The difference between this and the
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index c938d03516c0..0087df7ba44e 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -11,9 +11,8 @@ obj-y += trace_selftest_dynamic.o
11endif 11endif
12 12
13# If unlikely tracing is enabled, do not trace these files 13# If unlikely tracing is enabled, do not trace these files
14ifdef CONFIG_TRACING_UNLIKELY 14ifdef CONFIG_TRACING_BRANCHES
15KBUILD_CFLAGS += '-Dlikely(x)=likely_notrace(x)' 15KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
16KBUILD_CFLAGS += '-Dunlikely(x)=unlikely_notrace(x)'
17endif 16endif
18 17
19obj-$(CONFIG_FUNCTION_TRACER) += libftrace.o 18obj-$(CONFIG_FUNCTION_TRACER) += libftrace.o
@@ -31,6 +30,6 @@ obj-$(CONFIG_STACK_TRACER) += trace_stack.o
31obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o 30obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o
32obj-$(CONFIG_BOOT_TRACER) += trace_boot.o 31obj-$(CONFIG_BOOT_TRACER) += trace_boot.o
33obj-$(CONFIG_FUNCTION_RET_TRACER) += trace_functions_return.o 32obj-$(CONFIG_FUNCTION_RET_TRACER) += trace_functions_return.o
34obj-$(CONFIG_TRACE_UNLIKELY_PROFILE) += trace_unlikely.o 33obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_unlikely.o
35 34
36libftrace-y := ftrace.o 35libftrace-y := ftrace.o
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d842db14a59b..bad59d32a4a9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -258,7 +258,7 @@ static const char *trace_options[] = {
258 "sched-tree", 258 "sched-tree",
259 "ftrace_printk", 259 "ftrace_printk",
260 "ftrace_preempt", 260 "ftrace_preempt",
261#ifdef CONFIG_UNLIKELY_TRACER 261#ifdef CONFIG_BRANCH_TRACER
262 "unlikely", 262 "unlikely",
263#endif 263#endif
264 NULL 264 NULL
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 9635aa2c4fc1..dccae6312941 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -468,7 +468,7 @@ enum trace_iterator_flags {
468 TRACE_ITER_SCHED_TREE = 0x200, 468 TRACE_ITER_SCHED_TREE = 0x200,
469 TRACE_ITER_PRINTK = 0x400, 469 TRACE_ITER_PRINTK = 0x400,
470 TRACE_ITER_PREEMPTONLY = 0x800, 470 TRACE_ITER_PREEMPTONLY = 0x800,
471#ifdef CONFIG_UNLIKELY_TRACER 471#ifdef CONFIG_BRANCH_TRACER
472 TRACE_ITER_UNLIKELY = 0x1000, 472 TRACE_ITER_UNLIKELY = 0x1000,
473#endif 473#endif
474}; 474};
@@ -530,7 +530,7 @@ static inline void ftrace_preempt_enable(int resched)
530 preempt_enable_notrace(); 530 preempt_enable_notrace();
531} 531}
532 532
533#ifdef CONFIG_UNLIKELY_TRACER 533#ifdef CONFIG_BRANCH_TRACER
534extern int enable_unlikely_tracing(struct trace_array *tr); 534extern int enable_unlikely_tracing(struct trace_array *tr);
535extern void disable_unlikely_tracing(void); 535extern void disable_unlikely_tracing(void);
536static inline int trace_unlikely_enable(struct trace_array *tr) 536static inline int trace_unlikely_enable(struct trace_array *tr)
@@ -552,6 +552,6 @@ static inline int trace_unlikely_enable(struct trace_array *tr)
552static inline void trace_unlikely_disable(void) 552static inline void trace_unlikely_disable(void)
553{ 553{
554} 554}
555#endif /* CONFIG_UNLIKELY_TRACER */ 555#endif /* CONFIG_BRANCH_TRACER */
556 556
557#endif /* _LINUX_KERNEL_TRACE_H */ 557#endif /* _LINUX_KERNEL_TRACE_H */
diff --git a/kernel/trace/trace_unlikely.c b/kernel/trace/trace_unlikely.c
index 7290e0e7b4e3..856eb3b7f694 100644
--- a/kernel/trace/trace_unlikely.c
+++ b/kernel/trace/trace_unlikely.c
@@ -15,7 +15,7 @@
15#include <asm/local.h> 15#include <asm/local.h>
16#include "trace.h" 16#include "trace.h"
17 17
18#ifdef CONFIG_UNLIKELY_TRACER 18#ifdef CONFIG_BRANCH_TRACER
19 19
20static int unlikely_tracing_enabled __read_mostly; 20static int unlikely_tracing_enabled __read_mostly;
21static DEFINE_MUTEX(unlikely_tracing_mutex); 21static DEFINE_MUTEX(unlikely_tracing_mutex);
@@ -119,7 +119,7 @@ static inline
119void trace_likely_condition(struct ftrace_likely_data *f, int val, int expect) 119void trace_likely_condition(struct ftrace_likely_data *f, int val, int expect)
120{ 120{
121} 121}
122#endif /* CONFIG_UNLIKELY_TRACER */ 122#endif /* CONFIG_BRANCH_TRACER */
123 123
124void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect) 124void ftrace_likely_update(struct ftrace_likely_data *f, int val, int expect)
125{ 125{