Thomas Gleixner | 1c6bec5 | 2019-06-01 10:08:47 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 2 | /* |
| 3 | * builtin-ftrace.c |
| 4 | * |
| 5 | * Copyright (c) 2013 LG Electronics, Namhyung Kim <namhyung@kernel.org> |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include "builtin.h" |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 9 | |
Arnaldo Carvalho de Melo | a43783a | 2017-04-18 10:46:11 -0300 | [diff] [blame] | 10 | #include <errno.h> |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 11 | #include <unistd.h> |
| 12 | #include <signal.h> |
Arnaldo Carvalho de Melo | f2a39fe | 2019-08-30 14:45:20 -0300 | [diff] [blame] | 13 | #include <stdlib.h> |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 14 | #include <fcntl.h> |
Arnaldo Carvalho de Melo | 4208735 | 2017-04-19 19:06:30 -0300 | [diff] [blame] | 15 | #include <poll.h> |
Igor Lubashev | c766f3d | 2019-08-07 10:44:17 -0400 | [diff] [blame] | 16 | #include <linux/capability.h> |
Arnaldo Carvalho de Melo | 8520a98 | 2019-08-29 16:18:59 -0300 | [diff] [blame] | 17 | #include <linux/string.h> |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 18 | |
| 19 | #include "debug.h" |
Arnaldo Carvalho de Melo | 8520a98 | 2019-08-29 16:18:59 -0300 | [diff] [blame] | 20 | #include <subcmd/pager.h> |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 21 | #include <subcmd/parse-options.h> |
Arnaldo Carvalho de Melo | 20a9ed2 | 2017-04-18 11:44:58 -0300 | [diff] [blame] | 22 | #include <api/fs/tracing_path.h> |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 23 | #include "evlist.h" |
| 24 | #include "target.h" |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 25 | #include "cpumap.h" |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 26 | #include "thread_map.h" |
Igor Lubashev | c766f3d | 2019-08-07 10:44:17 -0400 | [diff] [blame] | 27 | #include "util/cap.h" |
Taeung Song | b05d109 | 2017-01-31 20:38:29 +0900 | [diff] [blame] | 28 | #include "util/config.h" |
Changbin Du | 846e193 | 2020-08-08 10:31:27 +0800 | [diff] [blame] | 29 | #include "util/units.h" |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 30 | #include "util/parse-sublevel-options.h" |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 31 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 32 | #define DEFAULT_TRACER "function_graph" |
| 33 | |
| 34 | struct perf_ftrace { |
Jiri Olsa | 63503db | 2019-07-21 13:23:52 +0200 | [diff] [blame] | 35 | struct evlist *evlist; |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 36 | struct target target; |
| 37 | const char *tracer; |
Changbin Du | d6d81bf | 2020-08-08 10:31:25 +0800 | [diff] [blame] | 38 | bool list_avail_functions; |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 39 | struct list_head filters; |
| 40 | struct list_head notrace; |
| 41 | struct list_head graph_funcs; |
| 42 | struct list_head nograph_funcs; |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 43 | int graph_depth; |
Changbin Du | 846e193 | 2020-08-08 10:31:27 +0800 | [diff] [blame] | 44 | unsigned long percpu_buffer_size; |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 45 | bool inherit; |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 46 | int func_stack_trace; |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | struct filter_entry { |
| 50 | struct list_head list; |
| 51 | char name[]; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 52 | }; |
| 53 | |
Changbin Du | 51a09d8 | 2020-05-10 23:06:11 +0800 | [diff] [blame] | 54 | static volatile int workload_exec_errno; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 55 | static bool done; |
| 56 | |
| 57 | static void sig_handler(int sig __maybe_unused) |
| 58 | { |
| 59 | done = true; |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | * perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since |
| 64 | * we asked by setting its exec_error to the function below, |
| 65 | * ftrace__workload_exec_failed_signal. |
| 66 | * |
| 67 | * XXX We need to handle this more appropriately, emitting an error, etc. |
| 68 | */ |
| 69 | static void ftrace__workload_exec_failed_signal(int signo __maybe_unused, |
| 70 | siginfo_t *info __maybe_unused, |
| 71 | void *ucontext __maybe_unused) |
| 72 | { |
Changbin Du | 51a09d8 | 2020-05-10 23:06:11 +0800 | [diff] [blame] | 73 | workload_exec_errno = info->si_value.sival_int; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 74 | done = true; |
| 75 | } |
| 76 | |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 77 | static int __write_tracing_file(const char *name, const char *val, bool append) |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 78 | { |
| 79 | char *file; |
| 80 | int fd, ret = -1; |
| 81 | ssize_t size = strlen(val); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 82 | int flags = O_WRONLY; |
Namhyung Kim | e7bd9ba | 2017-06-18 23:22:59 +0900 | [diff] [blame] | 83 | char errbuf[512]; |
Changbin Du | 63cd02d | 2018-02-19 10:33:29 +0800 | [diff] [blame] | 84 | char *val_copy; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 85 | |
| 86 | file = get_tracing_file(name); |
| 87 | if (!file) { |
| 88 | pr_debug("cannot get tracing file: %s\n", name); |
| 89 | return -1; |
| 90 | } |
| 91 | |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 92 | if (append) |
| 93 | flags |= O_APPEND; |
| 94 | else |
| 95 | flags |= O_TRUNC; |
| 96 | |
| 97 | fd = open(file, flags); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 98 | if (fd < 0) { |
Namhyung Kim | e7bd9ba | 2017-06-18 23:22:59 +0900 | [diff] [blame] | 99 | pr_debug("cannot open tracing file: %s: %s\n", |
| 100 | name, str_error_r(errno, errbuf, sizeof(errbuf))); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 101 | goto out; |
| 102 | } |
| 103 | |
Changbin Du | 63cd02d | 2018-02-19 10:33:29 +0800 | [diff] [blame] | 104 | /* |
| 105 | * Copy the original value and append a '\n'. Without this, |
| 106 | * the kernel can hide possible errors. |
| 107 | */ |
| 108 | val_copy = strdup(val); |
| 109 | if (!val_copy) |
| 110 | goto out_close; |
| 111 | val_copy[size] = '\n'; |
| 112 | |
| 113 | if (write(fd, val_copy, size + 1) == size + 1) |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 114 | ret = 0; |
| 115 | else |
Namhyung Kim | e7bd9ba | 2017-06-18 23:22:59 +0900 | [diff] [blame] | 116 | pr_debug("write '%s' to tracing/%s failed: %s\n", |
| 117 | val, name, str_error_r(errno, errbuf, sizeof(errbuf))); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 118 | |
Changbin Du | 63cd02d | 2018-02-19 10:33:29 +0800 | [diff] [blame] | 119 | free(val_copy); |
| 120 | out_close: |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 121 | close(fd); |
| 122 | out: |
| 123 | put_tracing_file(file); |
| 124 | return ret; |
| 125 | } |
| 126 | |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 127 | static int write_tracing_file(const char *name, const char *val) |
| 128 | { |
| 129 | return __write_tracing_file(name, val, false); |
| 130 | } |
| 131 | |
| 132 | static int append_tracing_file(const char *name, const char *val) |
| 133 | { |
| 134 | return __write_tracing_file(name, val, true); |
| 135 | } |
| 136 | |
Changbin Du | d6d81bf | 2020-08-08 10:31:25 +0800 | [diff] [blame] | 137 | static int read_tracing_file_to_stdout(const char *name) |
| 138 | { |
| 139 | char buf[4096]; |
| 140 | char *file; |
| 141 | int fd; |
| 142 | int ret = -1; |
| 143 | |
| 144 | file = get_tracing_file(name); |
| 145 | if (!file) { |
| 146 | pr_debug("cannot get tracing file: %s\n", name); |
| 147 | return -1; |
| 148 | } |
| 149 | |
| 150 | fd = open(file, O_RDONLY); |
| 151 | if (fd < 0) { |
| 152 | pr_debug("cannot open tracing file: %s: %s\n", |
| 153 | name, str_error_r(errno, buf, sizeof(buf))); |
| 154 | goto out; |
| 155 | } |
| 156 | |
| 157 | /* read contents to stdout */ |
| 158 | while (true) { |
| 159 | int n = read(fd, buf, sizeof(buf)); |
| 160 | if (n == 0) |
| 161 | break; |
| 162 | else if (n < 0) |
| 163 | goto out_close; |
| 164 | |
| 165 | if (fwrite(buf, n, 1, stdout) != 1) |
| 166 | goto out_close; |
| 167 | } |
| 168 | ret = 0; |
| 169 | |
| 170 | out_close: |
| 171 | close(fd); |
| 172 | out: |
| 173 | put_tracing_file(file); |
| 174 | return ret; |
| 175 | } |
| 176 | |
Changbin Du | 68faab0 | 2020-08-08 10:31:26 +0800 | [diff] [blame] | 177 | static int write_tracing_file_int(const char *name, int value) |
| 178 | { |
| 179 | char buf[16]; |
| 180 | |
| 181 | snprintf(buf, sizeof(buf), "%d", value); |
| 182 | if (write_tracing_file(name, buf) < 0) |
| 183 | return -1; |
| 184 | |
| 185 | return 0; |
| 186 | } |
| 187 | |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 188 | static int write_tracing_option_file(const char *name, const char *val) |
| 189 | { |
| 190 | char *file; |
| 191 | int ret; |
| 192 | |
| 193 | if (asprintf(&file, "options/%s", name) < 0) |
| 194 | return -1; |
| 195 | |
| 196 | ret = __write_tracing_file(file, val, false); |
| 197 | free(file); |
| 198 | return ret; |
| 199 | } |
| 200 | |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 201 | static int reset_tracing_cpu(void); |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 202 | static void reset_tracing_filters(void); |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 203 | |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 204 | static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused) |
| 205 | { |
| 206 | write_tracing_option_file("function-fork", "0"); |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 207 | write_tracing_option_file("func_stack_trace", "0"); |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 208 | } |
| 209 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 210 | static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) |
| 211 | { |
| 212 | if (write_tracing_file("tracing_on", "0") < 0) |
| 213 | return -1; |
| 214 | |
| 215 | if (write_tracing_file("current_tracer", "nop") < 0) |
| 216 | return -1; |
| 217 | |
| 218 | if (write_tracing_file("set_ftrace_pid", " ") < 0) |
| 219 | return -1; |
| 220 | |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 221 | if (reset_tracing_cpu() < 0) |
| 222 | return -1; |
| 223 | |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 224 | if (write_tracing_file("max_graph_depth", "0") < 0) |
| 225 | return -1; |
| 226 | |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 227 | reset_tracing_filters(); |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 228 | reset_tracing_options(ftrace); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 229 | return 0; |
| 230 | } |
| 231 | |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 232 | static int set_tracing_pid(struct perf_ftrace *ftrace) |
| 233 | { |
| 234 | int i; |
| 235 | char buf[16]; |
| 236 | |
| 237 | if (target__has_cpu(&ftrace->target)) |
| 238 | return 0; |
| 239 | |
Jiri Olsa | a2f354e | 2019-08-22 13:11:41 +0200 | [diff] [blame] | 240 | for (i = 0; i < perf_thread_map__nr(ftrace->evlist->core.threads); i++) { |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 241 | scnprintf(buf, sizeof(buf), "%d", |
Jiri Olsa | 03617c2 | 2019-07-21 13:24:42 +0200 | [diff] [blame] | 242 | ftrace->evlist->core.threads->map[i]); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 243 | if (append_tracing_file("set_ftrace_pid", buf) < 0) |
| 244 | return -1; |
| 245 | } |
| 246 | return 0; |
| 247 | } |
| 248 | |
Jiri Olsa | f854839 | 2019-07-21 13:23:49 +0200 | [diff] [blame] | 249 | static int set_tracing_cpumask(struct perf_cpu_map *cpumap) |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 250 | { |
| 251 | char *cpumask; |
| 252 | size_t mask_size; |
| 253 | int ret; |
| 254 | int last_cpu; |
| 255 | |
| 256 | last_cpu = cpu_map__cpu(cpumap, cpumap->nr - 1); |
He Zhe | cf30ae7 | 2019-08-02 16:29:51 +0800 | [diff] [blame] | 257 | mask_size = last_cpu / 4 + 2; /* one more byte for EOS */ |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 258 | mask_size += last_cpu / 32; /* ',' is needed for every 32th cpus */ |
| 259 | |
| 260 | cpumask = malloc(mask_size); |
| 261 | if (cpumask == NULL) { |
| 262 | pr_debug("failed to allocate cpu mask\n"); |
| 263 | return -1; |
| 264 | } |
| 265 | |
| 266 | cpu_map__snprint_mask(cpumap, cpumask, mask_size); |
| 267 | |
| 268 | ret = write_tracing_file("tracing_cpumask", cpumask); |
| 269 | |
| 270 | free(cpumask); |
| 271 | return ret; |
| 272 | } |
| 273 | |
| 274 | static int set_tracing_cpu(struct perf_ftrace *ftrace) |
| 275 | { |
Jiri Olsa | f72f901 | 2019-07-21 13:24:41 +0200 | [diff] [blame] | 276 | struct perf_cpu_map *cpumap = ftrace->evlist->core.cpus; |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 277 | |
| 278 | if (!target__has_cpu(&ftrace->target)) |
| 279 | return 0; |
| 280 | |
| 281 | return set_tracing_cpumask(cpumap); |
| 282 | } |
| 283 | |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 284 | static int set_tracing_func_stack_trace(struct perf_ftrace *ftrace) |
| 285 | { |
| 286 | if (!ftrace->func_stack_trace) |
| 287 | return 0; |
| 288 | |
| 289 | if (write_tracing_option_file("func_stack_trace", "1") < 0) |
| 290 | return -1; |
| 291 | |
| 292 | return 0; |
| 293 | } |
| 294 | |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 295 | static int reset_tracing_cpu(void) |
| 296 | { |
Jiri Olsa | 9c3516d | 2019-07-21 13:24:30 +0200 | [diff] [blame] | 297 | struct perf_cpu_map *cpumap = perf_cpu_map__new(NULL); |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 298 | int ret; |
| 299 | |
| 300 | ret = set_tracing_cpumask(cpumap); |
Jiri Olsa | 38f01d8 | 2019-07-21 13:24:17 +0200 | [diff] [blame] | 301 | perf_cpu_map__put(cpumap); |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 302 | return ret; |
| 303 | } |
| 304 | |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 305 | static int __set_tracing_filter(const char *filter_file, struct list_head *funcs) |
| 306 | { |
| 307 | struct filter_entry *pos; |
| 308 | |
| 309 | list_for_each_entry(pos, funcs, list) { |
| 310 | if (append_tracing_file(filter_file, pos->name) < 0) |
| 311 | return -1; |
| 312 | } |
| 313 | |
| 314 | return 0; |
| 315 | } |
| 316 | |
| 317 | static int set_tracing_filters(struct perf_ftrace *ftrace) |
| 318 | { |
| 319 | int ret; |
| 320 | |
| 321 | ret = __set_tracing_filter("set_ftrace_filter", &ftrace->filters); |
| 322 | if (ret < 0) |
| 323 | return ret; |
| 324 | |
| 325 | ret = __set_tracing_filter("set_ftrace_notrace", &ftrace->notrace); |
| 326 | if (ret < 0) |
| 327 | return ret; |
| 328 | |
| 329 | ret = __set_tracing_filter("set_graph_function", &ftrace->graph_funcs); |
| 330 | if (ret < 0) |
| 331 | return ret; |
| 332 | |
| 333 | /* old kernels do not have this filter */ |
| 334 | __set_tracing_filter("set_graph_notrace", &ftrace->nograph_funcs); |
| 335 | |
| 336 | return ret; |
| 337 | } |
| 338 | |
| 339 | static void reset_tracing_filters(void) |
| 340 | { |
| 341 | write_tracing_file("set_ftrace_filter", " "); |
| 342 | write_tracing_file("set_ftrace_notrace", " "); |
| 343 | write_tracing_file("set_graph_function", " "); |
| 344 | write_tracing_file("set_graph_notrace", " "); |
| 345 | } |
| 346 | |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 347 | static int set_tracing_depth(struct perf_ftrace *ftrace) |
| 348 | { |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 349 | if (ftrace->graph_depth == 0) |
| 350 | return 0; |
| 351 | |
| 352 | if (ftrace->graph_depth < 0) { |
| 353 | pr_err("invalid graph depth: %d\n", ftrace->graph_depth); |
| 354 | return -1; |
| 355 | } |
| 356 | |
Changbin Du | 68faab0 | 2020-08-08 10:31:26 +0800 | [diff] [blame] | 357 | if (write_tracing_file_int("max_graph_depth", ftrace->graph_depth) < 0) |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 358 | return -1; |
| 359 | |
| 360 | return 0; |
| 361 | } |
| 362 | |
Changbin Du | 846e193 | 2020-08-08 10:31:27 +0800 | [diff] [blame] | 363 | static int set_tracing_percpu_buffer_size(struct perf_ftrace *ftrace) |
| 364 | { |
| 365 | int ret; |
| 366 | |
| 367 | if (ftrace->percpu_buffer_size == 0) |
| 368 | return 0; |
| 369 | |
| 370 | ret = write_tracing_file_int("buffer_size_kb", |
| 371 | ftrace->percpu_buffer_size / 1024); |
| 372 | if (ret < 0) |
| 373 | return ret; |
| 374 | |
| 375 | return 0; |
| 376 | } |
| 377 | |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 378 | static int set_tracing_trace_inherit(struct perf_ftrace *ftrace) |
| 379 | { |
| 380 | if (!ftrace->inherit) |
| 381 | return 0; |
| 382 | |
| 383 | if (write_tracing_option_file("function-fork", "1") < 0) |
| 384 | return -1; |
| 385 | |
| 386 | return 0; |
| 387 | } |
| 388 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 389 | static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) |
| 390 | { |
| 391 | char *trace_file; |
| 392 | int trace_fd; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 393 | char buf[4096]; |
| 394 | struct pollfd pollfd = { |
| 395 | .events = POLLIN, |
| 396 | }; |
| 397 | |
Alexey Budankov | 6b3e0e2 | 2020-04-02 11:47:35 +0300 | [diff] [blame] | 398 | if (!(perf_cap__capable(CAP_PERFMON) || |
| 399 | perf_cap__capable(CAP_SYS_ADMIN))) { |
Arnaldo Carvalho de Melo | 73e5de7 | 2019-08-12 17:27:11 -0300 | [diff] [blame] | 400 | pr_err("ftrace only works for %s!\n", |
| 401 | #ifdef HAVE_LIBCAP_SUPPORT |
Alexey Budankov | 6b3e0e2 | 2020-04-02 11:47:35 +0300 | [diff] [blame] | 402 | "users with the CAP_PERFMON or CAP_SYS_ADMIN capability" |
Arnaldo Carvalho de Melo | 73e5de7 | 2019-08-12 17:27:11 -0300 | [diff] [blame] | 403 | #else |
| 404 | "root" |
| 405 | #endif |
| 406 | ); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 407 | return -1; |
| 408 | } |
| 409 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 410 | signal(SIGINT, sig_handler); |
| 411 | signal(SIGUSR1, sig_handler); |
| 412 | signal(SIGCHLD, sig_handler); |
Namhyung Kim | 5833596 | 2017-02-24 10:12:51 +0900 | [diff] [blame] | 413 | signal(SIGPIPE, sig_handler); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 414 | |
Changbin Du | d6d81bf | 2020-08-08 10:31:25 +0800 | [diff] [blame] | 415 | if (ftrace->list_avail_functions) |
| 416 | return read_tracing_file_to_stdout("available_filter_functions"); |
| 417 | |
Changbin Du | 63cd02d | 2018-02-19 10:33:29 +0800 | [diff] [blame] | 418 | if (reset_tracing_files(ftrace) < 0) { |
| 419 | pr_err("failed to reset ftrace\n"); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 420 | goto out; |
Changbin Du | 63cd02d | 2018-02-19 10:33:29 +0800 | [diff] [blame] | 421 | } |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 422 | |
| 423 | /* reset ftrace buffer */ |
| 424 | if (write_tracing_file("trace", "0") < 0) |
| 425 | goto out; |
| 426 | |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 427 | if (argc && perf_evlist__prepare_workload(ftrace->evlist, |
| 428 | &ftrace->target, argv, false, |
| 429 | ftrace__workload_exec_failed_signal) < 0) { |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 430 | goto out; |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | if (set_tracing_pid(ftrace) < 0) { |
| 434 | pr_err("failed to set ftrace pid\n"); |
| 435 | goto out_reset; |
| 436 | } |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 437 | |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 438 | if (set_tracing_cpu(ftrace) < 0) { |
| 439 | pr_err("failed to set tracing cpumask\n"); |
| 440 | goto out_reset; |
| 441 | } |
| 442 | |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 443 | if (set_tracing_func_stack_trace(ftrace) < 0) { |
| 444 | pr_err("failed to set tracing option func_stack_trace\n"); |
| 445 | goto out_reset; |
| 446 | } |
| 447 | |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 448 | if (set_tracing_filters(ftrace) < 0) { |
| 449 | pr_err("failed to set tracing filters\n"); |
| 450 | goto out_reset; |
| 451 | } |
| 452 | |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 453 | if (set_tracing_depth(ftrace) < 0) { |
| 454 | pr_err("failed to set graph depth\n"); |
| 455 | goto out_reset; |
| 456 | } |
| 457 | |
Changbin Du | 846e193 | 2020-08-08 10:31:27 +0800 | [diff] [blame] | 458 | if (set_tracing_percpu_buffer_size(ftrace) < 0) { |
| 459 | pr_err("failed to set tracing per-cpu buffer size\n"); |
| 460 | goto out_reset; |
| 461 | } |
| 462 | |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 463 | if (set_tracing_trace_inherit(ftrace) < 0) { |
| 464 | pr_err("failed to set tracing option function-fork\n"); |
| 465 | goto out_reset; |
| 466 | } |
| 467 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 468 | if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { |
| 469 | pr_err("failed to set current_tracer to %s\n", ftrace->tracer); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 470 | goto out_reset; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 471 | } |
| 472 | |
Namhyung Kim | 29681bc | 2017-06-18 23:23:00 +0900 | [diff] [blame] | 473 | setup_pager(); |
| 474 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 475 | trace_file = get_tracing_file("trace_pipe"); |
| 476 | if (!trace_file) { |
| 477 | pr_err("failed to open trace_pipe\n"); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 478 | goto out_reset; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | trace_fd = open(trace_file, O_RDONLY); |
| 482 | |
| 483 | put_tracing_file(trace_file); |
| 484 | |
| 485 | if (trace_fd < 0) { |
| 486 | pr_err("failed to open trace_pipe\n"); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 487 | goto out_reset; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | fcntl(trace_fd, F_SETFL, O_NONBLOCK); |
| 491 | pollfd.fd = trace_fd; |
| 492 | |
Changbin Du | 81523c1 | 2020-08-08 10:31:28 +0800 | [diff] [blame] | 493 | /* display column headers */ |
| 494 | read_tracing_file_to_stdout("trace"); |
| 495 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 496 | if (write_tracing_file("tracing_on", "1") < 0) { |
| 497 | pr_err("can't enable tracing\n"); |
| 498 | goto out_close_fd; |
| 499 | } |
| 500 | |
| 501 | perf_evlist__start_workload(ftrace->evlist); |
| 502 | |
| 503 | while (!done) { |
| 504 | if (poll(&pollfd, 1, -1) < 0) |
| 505 | break; |
| 506 | |
| 507 | if (pollfd.revents & POLLIN) { |
| 508 | int n = read(trace_fd, buf, sizeof(buf)); |
| 509 | if (n < 0) |
| 510 | break; |
| 511 | if (fwrite(buf, n, 1, stdout) != 1) |
| 512 | break; |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | write_tracing_file("tracing_on", "0"); |
| 517 | |
Changbin Du | 51a09d8 | 2020-05-10 23:06:11 +0800 | [diff] [blame] | 518 | if (workload_exec_errno) { |
| 519 | const char *emsg = str_error_r(workload_exec_errno, buf, sizeof(buf)); |
| 520 | /* flush stdout first so below error msg appears at the end. */ |
| 521 | fflush(stdout); |
| 522 | pr_err("workload failed: %s\n", emsg); |
| 523 | goto out_close_fd; |
| 524 | } |
| 525 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 526 | /* read remaining buffer contents */ |
| 527 | while (true) { |
| 528 | int n = read(trace_fd, buf, sizeof(buf)); |
| 529 | if (n <= 0) |
| 530 | break; |
| 531 | if (fwrite(buf, n, 1, stdout) != 1) |
| 532 | break; |
| 533 | } |
| 534 | |
| 535 | out_close_fd: |
| 536 | close(trace_fd); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 537 | out_reset: |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 538 | reset_tracing_files(ftrace); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 539 | out: |
Changbin Du | 51a09d8 | 2020-05-10 23:06:11 +0800 | [diff] [blame] | 540 | return (done && !workload_exec_errno) ? 0 : -1; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 541 | } |
| 542 | |
Taeung Song | b05d109 | 2017-01-31 20:38:29 +0900 | [diff] [blame] | 543 | static int perf_ftrace_config(const char *var, const char *value, void *cb) |
| 544 | { |
| 545 | struct perf_ftrace *ftrace = cb; |
| 546 | |
Arnaldo Carvalho de Melo | 8e99b6d | 2017-07-20 15:27:39 -0300 | [diff] [blame] | 547 | if (!strstarts(var, "ftrace.")) |
Taeung Song | b05d109 | 2017-01-31 20:38:29 +0900 | [diff] [blame] | 548 | return 0; |
| 549 | |
| 550 | if (strcmp(var, "ftrace.tracer")) |
| 551 | return -1; |
| 552 | |
| 553 | if (!strcmp(value, "function_graph") || |
| 554 | !strcmp(value, "function")) { |
| 555 | ftrace->tracer = value; |
| 556 | return 0; |
| 557 | } |
| 558 | |
| 559 | pr_err("Please select \"function_graph\" (default) or \"function\"\n"); |
| 560 | return -1; |
| 561 | } |
| 562 | |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 563 | static int parse_filter_func(const struct option *opt, const char *str, |
| 564 | int unset __maybe_unused) |
| 565 | { |
| 566 | struct list_head *head = opt->value; |
| 567 | struct filter_entry *entry; |
| 568 | |
| 569 | entry = malloc(sizeof(*entry) + strlen(str) + 1); |
| 570 | if (entry == NULL) |
| 571 | return -ENOMEM; |
| 572 | |
| 573 | strcpy(entry->name, str); |
| 574 | list_add_tail(&entry->list, head); |
| 575 | |
| 576 | return 0; |
| 577 | } |
| 578 | |
| 579 | static void delete_filter_func(struct list_head *head) |
| 580 | { |
| 581 | struct filter_entry *pos, *tmp; |
| 582 | |
| 583 | list_for_each_entry_safe(pos, tmp, head, list) { |
Arnaldo Carvalho de Melo | e56fbc9 | 2019-07-04 12:13:46 -0300 | [diff] [blame] | 584 | list_del_init(&pos->list); |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 585 | free(pos); |
| 586 | } |
| 587 | } |
| 588 | |
Changbin Du | 846e193 | 2020-08-08 10:31:27 +0800 | [diff] [blame] | 589 | static int parse_buffer_size(const struct option *opt, |
| 590 | const char *str, int unset) |
| 591 | { |
| 592 | unsigned long *s = (unsigned long *)opt->value; |
| 593 | static struct parse_tag tags_size[] = { |
| 594 | { .tag = 'B', .mult = 1 }, |
| 595 | { .tag = 'K', .mult = 1 << 10 }, |
| 596 | { .tag = 'M', .mult = 1 << 20 }, |
| 597 | { .tag = 'G', .mult = 1 << 30 }, |
| 598 | { .tag = 0 }, |
| 599 | }; |
| 600 | unsigned long val; |
| 601 | |
| 602 | if (unset) { |
| 603 | *s = 0; |
| 604 | return 0; |
| 605 | } |
| 606 | |
| 607 | val = parse_tag_value(str, tags_size); |
| 608 | if (val != (unsigned long) -1) { |
| 609 | if (val < 1024) { |
| 610 | pr_err("buffer size too small, must larger than 1KB."); |
| 611 | return -1; |
| 612 | } |
| 613 | *s = val; |
| 614 | return 0; |
| 615 | } |
| 616 | |
| 617 | return -1; |
| 618 | } |
| 619 | |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 620 | static int parse_func_tracer_opts(const struct option *opt, |
| 621 | const char *str, int unset) |
| 622 | { |
| 623 | int ret; |
| 624 | struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value; |
| 625 | struct sublevel_option func_tracer_opts[] = { |
| 626 | { .name = "call-graph", .value_ptr = &ftrace->func_stack_trace }, |
| 627 | { .name = NULL, } |
| 628 | }; |
| 629 | |
| 630 | if (unset) |
| 631 | return 0; |
| 632 | |
| 633 | ret = perf_parse_sublevel_options(str, func_tracer_opts); |
| 634 | if (ret) |
| 635 | return ret; |
| 636 | |
| 637 | return 0; |
| 638 | } |
| 639 | |
Changbin Du | eb6d31a | 2020-08-08 10:31:24 +0800 | [diff] [blame] | 640 | static void select_tracer(struct perf_ftrace *ftrace) |
| 641 | { |
| 642 | bool graph = !list_empty(&ftrace->graph_funcs) || |
| 643 | !list_empty(&ftrace->nograph_funcs); |
| 644 | bool func = !list_empty(&ftrace->filters) || |
| 645 | !list_empty(&ftrace->notrace); |
| 646 | |
| 647 | /* The function_graph has priority over function tracer. */ |
| 648 | if (graph) |
| 649 | ftrace->tracer = "function_graph"; |
| 650 | else if (func) |
| 651 | ftrace->tracer = "function"; |
| 652 | /* Otherwise, the default tracer is used. */ |
| 653 | |
| 654 | pr_debug("%s tracer is used\n", ftrace->tracer); |
| 655 | } |
| 656 | |
Arnaldo Carvalho de Melo | b0ad8ea | 2017-03-27 11:47:20 -0300 | [diff] [blame] | 657 | int cmd_ftrace(int argc, const char **argv) |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 658 | { |
| 659 | int ret; |
| 660 | struct perf_ftrace ftrace = { |
Taeung Song | bf062bd | 2017-01-26 18:35:37 +0900 | [diff] [blame] | 661 | .tracer = DEFAULT_TRACER, |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 662 | .target = { .uid = UINT_MAX, }, |
| 663 | }; |
| 664 | const char * const ftrace_usage[] = { |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 665 | "perf ftrace [<options>] [<command>]", |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 666 | "perf ftrace [<options>] -- <command> [<options>]", |
| 667 | NULL |
| 668 | }; |
| 669 | const struct option ftrace_options[] = { |
| 670 | OPT_STRING('t', "tracer", &ftrace.tracer, "tracer", |
Arnaldo Carvalho de Melo | ec34787 | 2017-01-18 21:49:14 -0300 | [diff] [blame] | 671 | "tracer to use: function_graph(default) or function"), |
Changbin Du | d6d81bf | 2020-08-08 10:31:25 +0800 | [diff] [blame] | 672 | OPT_BOOLEAN('F', "funcs", &ftrace.list_avail_functions, |
| 673 | "Show available functions to filter"), |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 674 | OPT_STRING('p', "pid", &ftrace.target.pid, "pid", |
| 675 | "trace on existing process id"), |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 676 | OPT_INCR('v', "verbose", &verbose, |
| 677 | "be more verbose"), |
Namhyung Kim | dc23103 | 2017-02-24 10:12:50 +0900 | [diff] [blame] | 678 | OPT_BOOLEAN('a', "all-cpus", &ftrace.target.system_wide, |
| 679 | "system-wide collection from all CPUs"), |
| 680 | OPT_STRING('C', "cpu", &ftrace.target.cpu_list, "cpu", |
| 681 | "list of cpus to monitor"), |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 682 | OPT_CALLBACK('T', "trace-funcs", &ftrace.filters, "func", |
Changbin Du | eb6d31a | 2020-08-08 10:31:24 +0800 | [diff] [blame] | 683 | "trace given functions using function tracer", |
| 684 | parse_filter_func), |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 685 | OPT_CALLBACK('N', "notrace-funcs", &ftrace.notrace, "func", |
| 686 | "do not trace given functions", parse_filter_func), |
Changbin Du | b1d84af | 2020-08-08 10:31:31 +0800 | [diff] [blame^] | 687 | OPT_CALLBACK(0, "func-opts", &ftrace, "options", |
| 688 | "function tracer options, available options: call-graph", |
| 689 | parse_func_tracer_opts), |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 690 | OPT_CALLBACK('G', "graph-funcs", &ftrace.graph_funcs, "func", |
Changbin Du | eb6d31a | 2020-08-08 10:31:24 +0800 | [diff] [blame] | 691 | "trace given functions using function_graph tracer", |
| 692 | parse_filter_func), |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 693 | OPT_CALLBACK('g', "nograph-funcs", &ftrace.nograph_funcs, "func", |
| 694 | "Set nograph filter on given functions", parse_filter_func), |
Namhyung Kim | 1096c35 | 2017-06-18 23:23:02 +0900 | [diff] [blame] | 695 | OPT_INTEGER('D', "graph-depth", &ftrace.graph_depth, |
| 696 | "Max depth for function graph tracer"), |
Changbin Du | 846e193 | 2020-08-08 10:31:27 +0800 | [diff] [blame] | 697 | OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size", |
| 698 | "size of per cpu buffer", parse_buffer_size), |
Changbin Du | 5b347472 | 2020-08-08 10:31:29 +0800 | [diff] [blame] | 699 | OPT_BOOLEAN(0, "inherit", &ftrace.inherit, |
| 700 | "trace children processes"), |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 701 | OPT_END() |
| 702 | }; |
| 703 | |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 704 | INIT_LIST_HEAD(&ftrace.filters); |
| 705 | INIT_LIST_HEAD(&ftrace.notrace); |
| 706 | INIT_LIST_HEAD(&ftrace.graph_funcs); |
| 707 | INIT_LIST_HEAD(&ftrace.nograph_funcs); |
| 708 | |
Taeung Song | b05d109 | 2017-01-31 20:38:29 +0900 | [diff] [blame] | 709 | ret = perf_config(perf_ftrace_config, &ftrace); |
| 710 | if (ret < 0) |
| 711 | return -1; |
| 712 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 713 | argc = parse_options(argc, argv, ftrace_options, ftrace_usage, |
| 714 | PARSE_OPT_STOP_AT_NON_OPTION); |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 715 | if (!argc && target__none(&ftrace.target)) |
Changbin Du | 452b0d1 | 2020-05-10 23:06:10 +0800 | [diff] [blame] | 716 | ftrace.target.system_wide = true; |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 717 | |
Changbin Du | eb6d31a | 2020-08-08 10:31:24 +0800 | [diff] [blame] | 718 | select_tracer(&ftrace); |
| 719 | |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 720 | ret = target__validate(&ftrace.target); |
| 721 | if (ret) { |
| 722 | char errbuf[512]; |
| 723 | |
| 724 | target__strerror(&ftrace.target, ret, errbuf, 512); |
| 725 | pr_err("%s\n", errbuf); |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 726 | goto out_delete_filters; |
Namhyung Kim | a9af6be | 2017-02-24 10:12:48 +0900 | [diff] [blame] | 727 | } |
| 728 | |
Jiri Olsa | 0f98b11 | 2019-07-21 13:23:55 +0200 | [diff] [blame] | 729 | ftrace.evlist = evlist__new(); |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 730 | if (ftrace.evlist == NULL) { |
| 731 | ret = -ENOMEM; |
| 732 | goto out_delete_filters; |
| 733 | } |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 734 | |
| 735 | ret = perf_evlist__create_maps(ftrace.evlist, &ftrace.target); |
| 736 | if (ret < 0) |
| 737 | goto out_delete_evlist; |
| 738 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 739 | ret = __cmd_ftrace(&ftrace, argc, argv); |
| 740 | |
| 741 | out_delete_evlist: |
Jiri Olsa | c12995a | 2019-07-21 13:23:56 +0200 | [diff] [blame] | 742 | evlist__delete(ftrace.evlist); |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 743 | |
Namhyung Kim | 78b83e8 | 2017-06-18 23:23:01 +0900 | [diff] [blame] | 744 | out_delete_filters: |
| 745 | delete_filter_func(&ftrace.filters); |
| 746 | delete_filter_func(&ftrace.notrace); |
| 747 | delete_filter_func(&ftrace.graph_funcs); |
| 748 | delete_filter_func(&ftrace.nograph_funcs); |
| 749 | |
Namhyung Kim | d01f4e8 | 2013-03-07 21:45:20 +0900 | [diff] [blame] | 750 | return ret; |
| 751 | } |