diff options
-rw-r--r-- | Documentation/trace/ftrace.txt | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/cpu_mf.h | 1 | ||||
-rw-r--r-- | kernel/trace/Kconfig | 24 | ||||
-rw-r--r-- | kernel/trace/trace.c | 27 |
4 files changed, 40 insertions, 14 deletions
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index 53d6a3c51d87..a372304aef10 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
@@ -1873,7 +1873,7 @@ feature: | |||
1873 | 1873 | ||
1874 | status\input | 0 | 1 | else | | 1874 | status\input | 0 | 1 | else | |
1875 | --------------+------------+------------+------------+ | 1875 | --------------+------------+------------+------------+ |
1876 | not allocated |(do nothing)| alloc+swap | EINVAL | | 1876 | not allocated |(do nothing)| alloc+swap |(do nothing)| |
1877 | --------------+------------+------------+------------+ | 1877 | --------------+------------+------------+------------+ |
1878 | allocated | free | swap | clear | | 1878 | allocated | free | swap | clear | |
1879 | --------------+------------+------------+------------+ | 1879 | --------------+------------+------------+------------+ |
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h index f1eddd150dd7..c879fad404c8 100644 --- a/arch/s390/include/asm/cpu_mf.h +++ b/arch/s390/include/asm/cpu_mf.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifndef _ASM_S390_CPU_MF_H | 12 | #ifndef _ASM_S390_CPU_MF_H |
13 | #define _ASM_S390_CPU_MF_H | 13 | #define _ASM_S390_CPU_MF_H |
14 | 14 | ||
15 | #include <linux/errno.h> | ||
15 | #include <asm/facility.h> | 16 | #include <asm/facility.h> |
16 | 17 | ||
17 | #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */ | 18 | #define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */ |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 192473b22799..fc382d6e2765 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -414,24 +414,28 @@ config PROBE_EVENTS | |||
414 | def_bool n | 414 | def_bool n |
415 | 415 | ||
416 | config DYNAMIC_FTRACE | 416 | config DYNAMIC_FTRACE |
417 | bool "enable/disable ftrace tracepoints dynamically" | 417 | bool "enable/disable function tracing dynamically" |
418 | depends on FUNCTION_TRACER | 418 | depends on FUNCTION_TRACER |
419 | depends on HAVE_DYNAMIC_FTRACE | 419 | depends on HAVE_DYNAMIC_FTRACE |
420 | default y | 420 | default y |
421 | help | 421 | help |
422 | This option will modify all the calls to ftrace dynamically | 422 | This option will modify all the calls to function tracing |
423 | (will patch them out of the binary image and replace them | 423 | dynamically (will patch them out of the binary image and |
424 | with a No-Op instruction) as they are called. A table is | 424 | replace them with a No-Op instruction) on boot up. During |
425 | created to dynamically enable them again. | 425 | compile time, a table is made of all the locations that ftrace |
426 | can function trace, and this table is linked into the kernel | ||
427 | image. When this is enabled, functions can be individually | ||
428 | enabled, and the functions not enabled will not affect | ||
429 | performance of the system. | ||
430 | |||
431 | See the files in /sys/kernel/debug/tracing: | ||
432 | available_filter_functions | ||
433 | set_ftrace_filter | ||
434 | set_ftrace_notrace | ||
426 | 435 | ||
427 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but | 436 | This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but |
428 | otherwise has native performance as long as no tracing is active. | 437 | otherwise has native performance as long as no tracing is active. |
429 | 438 | ||
430 | The changes to the code are done by a kernel thread that | ||
431 | wakes up once a second and checks to see if any ftrace calls | ||
432 | were made. If so, it runs stop_machine (stops all CPUS) | ||
433 | and modifies the code to jump over the call to ftrace. | ||
434 | |||
435 | config DYNAMIC_FTRACE_WITH_REGS | 439 | config DYNAMIC_FTRACE_WITH_REGS |
436 | def_bool y | 440 | def_bool y |
437 | depends on DYNAMIC_FTRACE | 441 | depends on DYNAMIC_FTRACE |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c2e2c2310374..1f835a83cb2c 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -2400,6 +2400,27 @@ static void test_ftrace_alive(struct seq_file *m) | |||
2400 | seq_printf(m, "# MAY BE MISSING FUNCTION EVENTS\n"); | 2400 | seq_printf(m, "# MAY BE MISSING FUNCTION EVENTS\n"); |
2401 | } | 2401 | } |
2402 | 2402 | ||
2403 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
2404 | static void print_snapshot_help(struct seq_file *m, struct trace_iterator *iter) | ||
2405 | { | ||
2406 | if (iter->trace->allocated_snapshot) | ||
2407 | seq_printf(m, "#\n# * Snapshot is allocated *\n#\n"); | ||
2408 | else | ||
2409 | seq_printf(m, "#\n# * Snapshot is freed *\n#\n"); | ||
2410 | |||
2411 | seq_printf(m, "# Snapshot commands:\n"); | ||
2412 | seq_printf(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n"); | ||
2413 | seq_printf(m, "# echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.\n"); | ||
2414 | seq_printf(m, "# Takes a snapshot of the main buffer.\n"); | ||
2415 | seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not allocate)\n"); | ||
2416 | seq_printf(m, "# (Doesn't have to be '2' works with any number that\n"); | ||
2417 | seq_printf(m, "# is not a '0' or '1')\n"); | ||
2418 | } | ||
2419 | #else | ||
2420 | /* Should never be called */ | ||
2421 | static inline void print_snapshot_help(struct seq_file *m, struct trace_iterator *iter) { } | ||
2422 | #endif | ||
2423 | |||
2403 | static int s_show(struct seq_file *m, void *v) | 2424 | static int s_show(struct seq_file *m, void *v) |
2404 | { | 2425 | { |
2405 | struct trace_iterator *iter = v; | 2426 | struct trace_iterator *iter = v; |
@@ -2411,7 +2432,9 @@ static int s_show(struct seq_file *m, void *v) | |||
2411 | seq_puts(m, "#\n"); | 2432 | seq_puts(m, "#\n"); |
2412 | test_ftrace_alive(m); | 2433 | test_ftrace_alive(m); |
2413 | } | 2434 | } |
2414 | if (iter->trace && iter->trace->print_header) | 2435 | if (iter->snapshot && trace_empty(iter)) |
2436 | print_snapshot_help(m, iter); | ||
2437 | else if (iter->trace && iter->trace->print_header) | ||
2415 | iter->trace->print_header(m); | 2438 | iter->trace->print_header(m); |
2416 | else | 2439 | else |
2417 | trace_default_header(m); | 2440 | trace_default_header(m); |
@@ -4144,8 +4167,6 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
4144 | default: | 4167 | default: |
4145 | if (current_trace->allocated_snapshot) | 4168 | if (current_trace->allocated_snapshot) |
4146 | tracing_reset_online_cpus(&max_tr); | 4169 | tracing_reset_online_cpus(&max_tr); |
4147 | else | ||
4148 | ret = -EINVAL; | ||
4149 | break; | 4170 | break; |
4150 | } | 4171 | } |
4151 | 4172 | ||