diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 22:58:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 22:58:13 -0500 |
commit | 1dd7dcb6eaa677b034e7ef63df8320277507ae70 (patch) | |
tree | 3f1592b634d7bdde94e00570925be2dade8433d4 /kernel/trace/trace_output.c | |
parent | b6da0076bab5a12afb19312ffee41c95490af2a0 (diff) | |
parent | 3558a5ac50dbb2419cc649d5e154af161d661037 (diff) |
Merge tag 'trace-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt:
"There was a lot of clean ups and minor fixes. One of those clean ups
was to the trace_seq code. It also removed the return values to the
trace_seq_*() functions and use trace_seq_has_overflowed() to see if
the buffer filled up or not. This is similar to work being done to
the seq_file code as well in another tree.
Some of the other goodies include:
- Added some "!" (NOT) logic to the tracing filter.
- Fixed the frame pointer logic to the x86_64 mcount trampolines
- Added the logic for dynamic trampolines on !CONFIG_PREEMPT systems.
That is, the ftrace trampoline can be dynamically allocated and be
called directly by functions that only have a single hook to them"
* tag 'trace-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (55 commits)
tracing: Truncated output is better than nothing
tracing: Add additional marks to signal very large time deltas
Documentation: describe trace_buf_size parameter more accurately
tracing: Allow NOT to filter AND and OR clauses
tracing: Add NOT to filtering logic
ftrace/fgraph/x86: Have prepare_ftrace_return() take ip as first parameter
ftrace/x86: Get rid of ftrace_caller_setup
ftrace/x86: Have save_mcount_regs macro also save stack frames if needed
ftrace/x86: Add macro MCOUNT_REG_SIZE for amount of stack used to save mcount regs
ftrace/x86: Simplify save_mcount_regs on getting RIP
ftrace/x86: Have save_mcount_regs store RIP in %rdi for first parameter
ftrace/x86: Rename MCOUNT_SAVE_FRAME and add more detailed comments
ftrace/x86: Move MCOUNT_SAVE_FRAME out of header file
ftrace/x86: Have static tracing also use ftrace_caller_setup
ftrace/x86: Have static function tracing always test for function graph
kprobes: Add IPMODIFY flag to kprobe_ftrace_ops
ftrace, kprobes: Support IPMODIFY flag to find IP modify conflict
kprobes/ftrace: Recover original IP if pre_handler doesn't change it
tracing/trivial: Fix typos and make an int into a bool
tracing: Deletion of an unnecessary check before iput()
...
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 446 |
1 files changed, 191 insertions, 255 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index c6977d5a9b12..b77b9a697619 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -25,15 +25,12 @@ enum print_line_t trace_print_bputs_msg_only(struct trace_iterator *iter) | |||
25 | struct trace_seq *s = &iter->seq; | 25 | struct trace_seq *s = &iter->seq; |
26 | struct trace_entry *entry = iter->ent; | 26 | struct trace_entry *entry = iter->ent; |
27 | struct bputs_entry *field; | 27 | struct bputs_entry *field; |
28 | int ret; | ||
29 | 28 | ||
30 | trace_assign_type(field, entry); | 29 | trace_assign_type(field, entry); |
31 | 30 | ||
32 | ret = trace_seq_puts(s, field->str); | 31 | trace_seq_puts(s, field->str); |
33 | if (!ret) | ||
34 | return TRACE_TYPE_PARTIAL_LINE; | ||
35 | 32 | ||
36 | return TRACE_TYPE_HANDLED; | 33 | return trace_handle_return(s); |
37 | } | 34 | } |
38 | 35 | ||
39 | enum print_line_t trace_print_bprintk_msg_only(struct trace_iterator *iter) | 36 | enum print_line_t trace_print_bprintk_msg_only(struct trace_iterator *iter) |
@@ -41,15 +38,12 @@ enum print_line_t trace_print_bprintk_msg_only(struct trace_iterator *iter) | |||
41 | struct trace_seq *s = &iter->seq; | 38 | struct trace_seq *s = &iter->seq; |
42 | struct trace_entry *entry = iter->ent; | 39 | struct trace_entry *entry = iter->ent; |
43 | struct bprint_entry *field; | 40 | struct bprint_entry *field; |
44 | int ret; | ||
45 | 41 | ||
46 | trace_assign_type(field, entry); | 42 | trace_assign_type(field, entry); |
47 | 43 | ||
48 | ret = trace_seq_bprintf(s, field->fmt, field->buf); | 44 | trace_seq_bprintf(s, field->fmt, field->buf); |
49 | if (!ret) | ||
50 | return TRACE_TYPE_PARTIAL_LINE; | ||
51 | 45 | ||
52 | return TRACE_TYPE_HANDLED; | 46 | return trace_handle_return(s); |
53 | } | 47 | } |
54 | 48 | ||
55 | enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter) | 49 | enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter) |
@@ -57,15 +51,12 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter) | |||
57 | struct trace_seq *s = &iter->seq; | 51 | struct trace_seq *s = &iter->seq; |
58 | struct trace_entry *entry = iter->ent; | 52 | struct trace_entry *entry = iter->ent; |
59 | struct print_entry *field; | 53 | struct print_entry *field; |
60 | int ret; | ||
61 | 54 | ||
62 | trace_assign_type(field, entry); | 55 | trace_assign_type(field, entry); |
63 | 56 | ||
64 | ret = trace_seq_puts(s, field->buf); | 57 | trace_seq_puts(s, field->buf); |
65 | if (!ret) | ||
66 | return TRACE_TYPE_PARTIAL_LINE; | ||
67 | 58 | ||
68 | return TRACE_TYPE_HANDLED; | 59 | return trace_handle_return(s); |
69 | } | 60 | } |
70 | 61 | ||
71 | const char * | 62 | const char * |
@@ -124,7 +115,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | |||
124 | 115 | ||
125 | if (ret == (const char *)(trace_seq_buffer_ptr(p))) | 116 | if (ret == (const char *)(trace_seq_buffer_ptr(p))) |
126 | trace_seq_printf(p, "0x%lx", val); | 117 | trace_seq_printf(p, "0x%lx", val); |
127 | 118 | ||
128 | trace_seq_putc(p, 0); | 119 | trace_seq_putc(p, 0); |
129 | 120 | ||
130 | return ret; | 121 | return ret; |
@@ -193,7 +184,6 @@ int ftrace_raw_output_prep(struct trace_iterator *iter, | |||
193 | struct trace_seq *s = &iter->seq; | 184 | struct trace_seq *s = &iter->seq; |
194 | struct trace_seq *p = &iter->tmp_seq; | 185 | struct trace_seq *p = &iter->tmp_seq; |
195 | struct trace_entry *entry; | 186 | struct trace_entry *entry; |
196 | int ret; | ||
197 | 187 | ||
198 | event = container_of(trace_event, struct ftrace_event_call, event); | 188 | event = container_of(trace_event, struct ftrace_event_call, event); |
199 | entry = iter->ent; | 189 | entry = iter->ent; |
@@ -204,11 +194,9 @@ int ftrace_raw_output_prep(struct trace_iterator *iter, | |||
204 | } | 194 | } |
205 | 195 | ||
206 | trace_seq_init(p); | 196 | trace_seq_init(p); |
207 | ret = trace_seq_printf(s, "%s: ", ftrace_event_name(event)); | 197 | trace_seq_printf(s, "%s: ", ftrace_event_name(event)); |
208 | if (!ret) | ||
209 | return TRACE_TYPE_PARTIAL_LINE; | ||
210 | 198 | ||
211 | return 0; | 199 | return trace_handle_return(s); |
212 | } | 200 | } |
213 | EXPORT_SYMBOL(ftrace_raw_output_prep); | 201 | EXPORT_SYMBOL(ftrace_raw_output_prep); |
214 | 202 | ||
@@ -216,18 +204,11 @@ static int ftrace_output_raw(struct trace_iterator *iter, char *name, | |||
216 | char *fmt, va_list ap) | 204 | char *fmt, va_list ap) |
217 | { | 205 | { |
218 | struct trace_seq *s = &iter->seq; | 206 | struct trace_seq *s = &iter->seq; |
219 | int ret; | ||
220 | |||
221 | ret = trace_seq_printf(s, "%s: ", name); | ||
222 | if (!ret) | ||
223 | return TRACE_TYPE_PARTIAL_LINE; | ||
224 | |||
225 | ret = trace_seq_vprintf(s, fmt, ap); | ||
226 | 207 | ||
227 | if (!ret) | 208 | trace_seq_printf(s, "%s: ", name); |
228 | return TRACE_TYPE_PARTIAL_LINE; | 209 | trace_seq_vprintf(s, fmt, ap); |
229 | 210 | ||
230 | return TRACE_TYPE_HANDLED; | 211 | return trace_handle_return(s); |
231 | } | 212 | } |
232 | 213 | ||
233 | int ftrace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...) | 214 | int ftrace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...) |
@@ -260,7 +241,7 @@ static inline const char *kretprobed(const char *name) | |||
260 | } | 241 | } |
261 | #endif /* CONFIG_KRETPROBES */ | 242 | #endif /* CONFIG_KRETPROBES */ |
262 | 243 | ||
263 | static int | 244 | static void |
264 | seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) | 245 | seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) |
265 | { | 246 | { |
266 | #ifdef CONFIG_KALLSYMS | 247 | #ifdef CONFIG_KALLSYMS |
@@ -271,12 +252,11 @@ seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) | |||
271 | 252 | ||
272 | name = kretprobed(str); | 253 | name = kretprobed(str); |
273 | 254 | ||
274 | return trace_seq_printf(s, fmt, name); | 255 | trace_seq_printf(s, fmt, name); |
275 | #endif | 256 | #endif |
276 | return 1; | ||
277 | } | 257 | } |
278 | 258 | ||
279 | static int | 259 | static void |
280 | seq_print_sym_offset(struct trace_seq *s, const char *fmt, | 260 | seq_print_sym_offset(struct trace_seq *s, const char *fmt, |
281 | unsigned long address) | 261 | unsigned long address) |
282 | { | 262 | { |
@@ -287,9 +267,8 @@ seq_print_sym_offset(struct trace_seq *s, const char *fmt, | |||
287 | sprint_symbol(str, address); | 267 | sprint_symbol(str, address); |
288 | name = kretprobed(str); | 268 | name = kretprobed(str); |
289 | 269 | ||
290 | return trace_seq_printf(s, fmt, name); | 270 | trace_seq_printf(s, fmt, name); |
291 | #endif | 271 | #endif |
292 | return 1; | ||
293 | } | 272 | } |
294 | 273 | ||
295 | #ifndef CONFIG_64BIT | 274 | #ifndef CONFIG_64BIT |
@@ -320,14 +299,14 @@ int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm, | |||
320 | if (file) { | 299 | if (file) { |
321 | ret = trace_seq_path(s, &file->f_path); | 300 | ret = trace_seq_path(s, &file->f_path); |
322 | if (ret) | 301 | if (ret) |
323 | ret = trace_seq_printf(s, "[+0x%lx]", | 302 | trace_seq_printf(s, "[+0x%lx]", |
324 | ip - vmstart); | 303 | ip - vmstart); |
325 | } | 304 | } |
326 | up_read(&mm->mmap_sem); | 305 | up_read(&mm->mmap_sem); |
327 | } | 306 | } |
328 | if (ret && ((sym_flags & TRACE_ITER_SYM_ADDR) || !file)) | 307 | if (ret && ((sym_flags & TRACE_ITER_SYM_ADDR) || !file)) |
329 | ret = trace_seq_printf(s, " <" IP_FMT ">", ip); | 308 | trace_seq_printf(s, " <" IP_FMT ">", ip); |
330 | return ret; | 309 | return !trace_seq_has_overflowed(s); |
331 | } | 310 | } |
332 | 311 | ||
333 | int | 312 | int |
@@ -335,7 +314,6 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s, | |||
335 | unsigned long sym_flags) | 314 | unsigned long sym_flags) |
336 | { | 315 | { |
337 | struct mm_struct *mm = NULL; | 316 | struct mm_struct *mm = NULL; |
338 | int ret = 1; | ||
339 | unsigned int i; | 317 | unsigned int i; |
340 | 318 | ||
341 | if (trace_flags & TRACE_ITER_SYM_USEROBJ) { | 319 | if (trace_flags & TRACE_ITER_SYM_USEROBJ) { |
@@ -354,48 +332,45 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s, | |||
354 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { | 332 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { |
355 | unsigned long ip = entry->caller[i]; | 333 | unsigned long ip = entry->caller[i]; |
356 | 334 | ||
357 | if (ip == ULONG_MAX || !ret) | 335 | if (ip == ULONG_MAX || trace_seq_has_overflowed(s)) |
358 | break; | 336 | break; |
359 | if (ret) | 337 | |
360 | ret = trace_seq_puts(s, " => "); | 338 | trace_seq_puts(s, " => "); |
339 | |||
361 | if (!ip) { | 340 | if (!ip) { |
362 | if (ret) | 341 | trace_seq_puts(s, "??"); |
363 | ret = trace_seq_puts(s, "??"); | 342 | trace_seq_putc(s, '\n'); |
364 | if (ret) | ||
365 | ret = trace_seq_putc(s, '\n'); | ||
366 | continue; | 343 | continue; |
367 | } | 344 | } |
368 | if (!ret) | 345 | |
369 | break; | 346 | seq_print_user_ip(s, mm, ip, sym_flags); |
370 | if (ret) | 347 | trace_seq_putc(s, '\n'); |
371 | ret = seq_print_user_ip(s, mm, ip, sym_flags); | ||
372 | ret = trace_seq_putc(s, '\n'); | ||
373 | } | 348 | } |
374 | 349 | ||
375 | if (mm) | 350 | if (mm) |
376 | mmput(mm); | 351 | mmput(mm); |
377 | return ret; | 352 | |
353 | return !trace_seq_has_overflowed(s); | ||
378 | } | 354 | } |
379 | 355 | ||
380 | int | 356 | int |
381 | seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) | 357 | seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) |
382 | { | 358 | { |
383 | int ret; | 359 | if (!ip) { |
384 | 360 | trace_seq_putc(s, '0'); | |
385 | if (!ip) | 361 | goto out; |
386 | return trace_seq_putc(s, '0'); | 362 | } |
387 | 363 | ||
388 | if (sym_flags & TRACE_ITER_SYM_OFFSET) | 364 | if (sym_flags & TRACE_ITER_SYM_OFFSET) |
389 | ret = seq_print_sym_offset(s, "%s", ip); | 365 | seq_print_sym_offset(s, "%s", ip); |
390 | else | 366 | else |
391 | ret = seq_print_sym_short(s, "%s", ip); | 367 | seq_print_sym_short(s, "%s", ip); |
392 | |||
393 | if (!ret) | ||
394 | return 0; | ||
395 | 368 | ||
396 | if (sym_flags & TRACE_ITER_SYM_ADDR) | 369 | if (sym_flags & TRACE_ITER_SYM_ADDR) |
397 | ret = trace_seq_printf(s, " <" IP_FMT ">", ip); | 370 | trace_seq_printf(s, " <" IP_FMT ">", ip); |
398 | return ret; | 371 | |
372 | out: | ||
373 | return !trace_seq_has_overflowed(s); | ||
399 | } | 374 | } |
400 | 375 | ||
401 | /** | 376 | /** |
@@ -413,7 +388,6 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) | |||
413 | char irqs_off; | 388 | char irqs_off; |
414 | int hardirq; | 389 | int hardirq; |
415 | int softirq; | 390 | int softirq; |
416 | int ret; | ||
417 | 391 | ||
418 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; | 392 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; |
419 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; | 393 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; |
@@ -445,16 +419,15 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) | |||
445 | softirq ? 's' : | 419 | softirq ? 's' : |
446 | '.'; | 420 | '.'; |
447 | 421 | ||
448 | if (!trace_seq_printf(s, "%c%c%c", | 422 | trace_seq_printf(s, "%c%c%c", |
449 | irqs_off, need_resched, hardsoft_irq)) | 423 | irqs_off, need_resched, hardsoft_irq); |
450 | return 0; | ||
451 | 424 | ||
452 | if (entry->preempt_count) | 425 | if (entry->preempt_count) |
453 | ret = trace_seq_printf(s, "%x", entry->preempt_count); | 426 | trace_seq_printf(s, "%x", entry->preempt_count); |
454 | else | 427 | else |
455 | ret = trace_seq_putc(s, '.'); | 428 | trace_seq_putc(s, '.'); |
456 | 429 | ||
457 | return ret; | 430 | return !trace_seq_has_overflowed(s); |
458 | } | 431 | } |
459 | 432 | ||
460 | static int | 433 | static int |
@@ -464,14 +437,38 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) | |||
464 | 437 | ||
465 | trace_find_cmdline(entry->pid, comm); | 438 | trace_find_cmdline(entry->pid, comm); |
466 | 439 | ||
467 | if (!trace_seq_printf(s, "%8.8s-%-5d %3d", | 440 | trace_seq_printf(s, "%8.8s-%-5d %3d", |
468 | comm, entry->pid, cpu)) | 441 | comm, entry->pid, cpu); |
469 | return 0; | ||
470 | 442 | ||
471 | return trace_print_lat_fmt(s, entry); | 443 | return trace_print_lat_fmt(s, entry); |
472 | } | 444 | } |
473 | 445 | ||
474 | static unsigned long preempt_mark_thresh_us = 100; | 446 | #undef MARK |
447 | #define MARK(v, s) {.val = v, .sym = s} | ||
448 | /* trace overhead mark */ | ||
449 | static const struct trace_mark { | ||
450 | unsigned long long val; /* unit: nsec */ | ||
451 | char sym; | ||
452 | } mark[] = { | ||
453 | MARK(1000000000ULL , '$'), /* 1 sec */ | ||
454 | MARK(1000000ULL , '#'), /* 1000 usecs */ | ||
455 | MARK(100000ULL , '!'), /* 100 usecs */ | ||
456 | MARK(10000ULL , '+'), /* 10 usecs */ | ||
457 | }; | ||
458 | #undef MARK | ||
459 | |||
460 | char trace_find_mark(unsigned long long d) | ||
461 | { | ||
462 | int i; | ||
463 | int size = ARRAY_SIZE(mark); | ||
464 | |||
465 | for (i = 0; i < size; i++) { | ||
466 | if (d >= mark[i].val) | ||
467 | break; | ||
468 | } | ||
469 | |||
470 | return (i == size) ? ' ' : mark[i].sym; | ||
471 | } | ||
475 | 472 | ||
476 | static int | 473 | static int |
477 | lat_print_timestamp(struct trace_iterator *iter, u64 next_ts) | 474 | lat_print_timestamp(struct trace_iterator *iter, u64 next_ts) |
@@ -493,24 +490,28 @@ lat_print_timestamp(struct trace_iterator *iter, u64 next_ts) | |||
493 | unsigned long rel_usec = do_div(rel_ts, USEC_PER_MSEC); | 490 | unsigned long rel_usec = do_div(rel_ts, USEC_PER_MSEC); |
494 | unsigned long rel_msec = (unsigned long)rel_ts; | 491 | unsigned long rel_msec = (unsigned long)rel_ts; |
495 | 492 | ||
496 | return trace_seq_printf( | 493 | trace_seq_printf( |
497 | s, "[%08llx] %ld.%03ldms (+%ld.%03ldms): ", | 494 | s, "[%08llx] %ld.%03ldms (+%ld.%03ldms): ", |
498 | ns2usecs(iter->ts), | 495 | ns2usecs(iter->ts), |
499 | abs_msec, abs_usec, | 496 | abs_msec, abs_usec, |
500 | rel_msec, rel_usec); | 497 | rel_msec, rel_usec); |
498 | |||
501 | } else if (verbose && !in_ns) { | 499 | } else if (verbose && !in_ns) { |
502 | return trace_seq_printf( | 500 | trace_seq_printf( |
503 | s, "[%016llx] %lld (+%lld): ", | 501 | s, "[%016llx] %lld (+%lld): ", |
504 | iter->ts, abs_ts, rel_ts); | 502 | iter->ts, abs_ts, rel_ts); |
503 | |||
505 | } else if (!verbose && in_ns) { | 504 | } else if (!verbose && in_ns) { |
506 | return trace_seq_printf( | 505 | trace_seq_printf( |
507 | s, " %4lldus%c: ", | 506 | s, " %4lldus%c: ", |
508 | abs_ts, | 507 | abs_ts, |
509 | rel_ts > preempt_mark_thresh_us ? '!' : | 508 | trace_find_mark(rel_ts * NSEC_PER_USEC)); |
510 | rel_ts > 1 ? '+' : ' '); | 509 | |
511 | } else { /* !verbose && !in_ns */ | 510 | } else { /* !verbose && !in_ns */ |
512 | return trace_seq_printf(s, " %4lld: ", abs_ts); | 511 | trace_seq_printf(s, " %4lld: ", abs_ts); |
513 | } | 512 | } |
513 | |||
514 | return !trace_seq_has_overflowed(s); | ||
514 | } | 515 | } |
515 | 516 | ||
516 | int trace_print_context(struct trace_iterator *iter) | 517 | int trace_print_context(struct trace_iterator *iter) |
@@ -520,34 +521,29 @@ int trace_print_context(struct trace_iterator *iter) | |||
520 | unsigned long long t; | 521 | unsigned long long t; |
521 | unsigned long secs, usec_rem; | 522 | unsigned long secs, usec_rem; |
522 | char comm[TASK_COMM_LEN]; | 523 | char comm[TASK_COMM_LEN]; |
523 | int ret; | ||
524 | 524 | ||
525 | trace_find_cmdline(entry->pid, comm); | 525 | trace_find_cmdline(entry->pid, comm); |
526 | 526 | ||
527 | ret = trace_seq_printf(s, "%16s-%-5d [%03d] ", | 527 | trace_seq_printf(s, "%16s-%-5d [%03d] ", |
528 | comm, entry->pid, iter->cpu); | 528 | comm, entry->pid, iter->cpu); |
529 | if (!ret) | ||
530 | return 0; | ||
531 | 529 | ||
532 | if (trace_flags & TRACE_ITER_IRQ_INFO) { | 530 | if (trace_flags & TRACE_ITER_IRQ_INFO) |
533 | ret = trace_print_lat_fmt(s, entry); | 531 | trace_print_lat_fmt(s, entry); |
534 | if (!ret) | ||
535 | return 0; | ||
536 | } | ||
537 | 532 | ||
538 | if (iter->iter_flags & TRACE_FILE_TIME_IN_NS) { | 533 | if (iter->iter_flags & TRACE_FILE_TIME_IN_NS) { |
539 | t = ns2usecs(iter->ts); | 534 | t = ns2usecs(iter->ts); |
540 | usec_rem = do_div(t, USEC_PER_SEC); | 535 | usec_rem = do_div(t, USEC_PER_SEC); |
541 | secs = (unsigned long)t; | 536 | secs = (unsigned long)t; |
542 | return trace_seq_printf(s, " %5lu.%06lu: ", secs, usec_rem); | 537 | trace_seq_printf(s, " %5lu.%06lu: ", secs, usec_rem); |
543 | } else | 538 | } else |
544 | return trace_seq_printf(s, " %12llu: ", iter->ts); | 539 | trace_seq_printf(s, " %12llu: ", iter->ts); |
540 | |||
541 | return !trace_seq_has_overflowed(s); | ||
545 | } | 542 | } |
546 | 543 | ||
547 | int trace_print_lat_context(struct trace_iterator *iter) | 544 | int trace_print_lat_context(struct trace_iterator *iter) |
548 | { | 545 | { |
549 | u64 next_ts; | 546 | u64 next_ts; |
550 | int ret; | ||
551 | /* trace_find_next_entry will reset ent_size */ | 547 | /* trace_find_next_entry will reset ent_size */ |
552 | int ent_size = iter->ent_size; | 548 | int ent_size = iter->ent_size; |
553 | struct trace_seq *s = &iter->seq; | 549 | struct trace_seq *s = &iter->seq; |
@@ -567,18 +563,17 @@ int trace_print_lat_context(struct trace_iterator *iter) | |||
567 | 563 | ||
568 | trace_find_cmdline(entry->pid, comm); | 564 | trace_find_cmdline(entry->pid, comm); |
569 | 565 | ||
570 | ret = trace_seq_printf( | 566 | trace_seq_printf( |
571 | s, "%16s %5d %3d %d %08x %08lx ", | 567 | s, "%16s %5d %3d %d %08x %08lx ", |
572 | comm, entry->pid, iter->cpu, entry->flags, | 568 | comm, entry->pid, iter->cpu, entry->flags, |
573 | entry->preempt_count, iter->idx); | 569 | entry->preempt_count, iter->idx); |
574 | } else { | 570 | } else { |
575 | ret = lat_print_generic(s, entry, iter->cpu); | 571 | lat_print_generic(s, entry, iter->cpu); |
576 | } | 572 | } |
577 | 573 | ||
578 | if (ret) | 574 | lat_print_timestamp(iter, next_ts); |
579 | ret = lat_print_timestamp(iter, next_ts); | ||
580 | 575 | ||
581 | return ret; | 576 | return !trace_seq_has_overflowed(s); |
582 | } | 577 | } |
583 | 578 | ||
584 | static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; | 579 | static const char state_to_char[] = TASK_STATE_TO_CHAR_STR; |
@@ -692,7 +687,7 @@ int register_ftrace_event(struct trace_event *event) | |||
692 | goto out; | 687 | goto out; |
693 | 688 | ||
694 | } else { | 689 | } else { |
695 | 690 | ||
696 | event->type = next_event_type++; | 691 | event->type = next_event_type++; |
697 | list = &ftrace_event_list; | 692 | list = &ftrace_event_list; |
698 | } | 693 | } |
@@ -764,10 +759,9 @@ EXPORT_SYMBOL_GPL(unregister_ftrace_event); | |||
764 | enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags, | 759 | enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags, |
765 | struct trace_event *event) | 760 | struct trace_event *event) |
766 | { | 761 | { |
767 | if (!trace_seq_printf(&iter->seq, "type: %d\n", iter->ent->type)) | 762 | trace_seq_printf(&iter->seq, "type: %d\n", iter->ent->type); |
768 | return TRACE_TYPE_PARTIAL_LINE; | ||
769 | 763 | ||
770 | return TRACE_TYPE_HANDLED; | 764 | return trace_handle_return(&iter->seq); |
771 | } | 765 | } |
772 | 766 | ||
773 | /* TRACE_FN */ | 767 | /* TRACE_FN */ |
@@ -779,24 +773,16 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags, | |||
779 | 773 | ||
780 | trace_assign_type(field, iter->ent); | 774 | trace_assign_type(field, iter->ent); |
781 | 775 | ||
782 | if (!seq_print_ip_sym(s, field->ip, flags)) | 776 | seq_print_ip_sym(s, field->ip, flags); |
783 | goto partial; | ||
784 | 777 | ||
785 | if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) { | 778 | if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) { |
786 | if (!trace_seq_puts(s, " <-")) | 779 | trace_seq_puts(s, " <-"); |
787 | goto partial; | 780 | seq_print_ip_sym(s, field->parent_ip, flags); |
788 | if (!seq_print_ip_sym(s, | ||
789 | field->parent_ip, | ||
790 | flags)) | ||
791 | goto partial; | ||
792 | } | 781 | } |
793 | if (!trace_seq_putc(s, '\n')) | ||
794 | goto partial; | ||
795 | 782 | ||
796 | return TRACE_TYPE_HANDLED; | 783 | trace_seq_putc(s, '\n'); |
797 | 784 | ||
798 | partial: | 785 | return trace_handle_return(s); |
799 | return TRACE_TYPE_PARTIAL_LINE; | ||
800 | } | 786 | } |
801 | 787 | ||
802 | static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags, | 788 | static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags, |
@@ -806,12 +792,11 @@ static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags, | |||
806 | 792 | ||
807 | trace_assign_type(field, iter->ent); | 793 | trace_assign_type(field, iter->ent); |
808 | 794 | ||
809 | if (!trace_seq_printf(&iter->seq, "%lx %lx\n", | 795 | trace_seq_printf(&iter->seq, "%lx %lx\n", |
810 | field->ip, | 796 | field->ip, |
811 | field->parent_ip)) | 797 | field->parent_ip); |
812 | return TRACE_TYPE_PARTIAL_LINE; | ||
813 | 798 | ||
814 | return TRACE_TYPE_HANDLED; | 799 | return trace_handle_return(&iter->seq); |
815 | } | 800 | } |
816 | 801 | ||
817 | static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags, | 802 | static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags, |
@@ -822,10 +807,10 @@ static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags, | |||
822 | 807 | ||
823 | trace_assign_type(field, iter->ent); | 808 | trace_assign_type(field, iter->ent); |
824 | 809 | ||
825 | SEQ_PUT_HEX_FIELD_RET(s, field->ip); | 810 | SEQ_PUT_HEX_FIELD(s, field->ip); |
826 | SEQ_PUT_HEX_FIELD_RET(s, field->parent_ip); | 811 | SEQ_PUT_HEX_FIELD(s, field->parent_ip); |
827 | 812 | ||
828 | return TRACE_TYPE_HANDLED; | 813 | return trace_handle_return(s); |
829 | } | 814 | } |
830 | 815 | ||
831 | static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags, | 816 | static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags, |
@@ -836,10 +821,10 @@ static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags, | |||
836 | 821 | ||
837 | trace_assign_type(field, iter->ent); | 822 | trace_assign_type(field, iter->ent); |
838 | 823 | ||
839 | SEQ_PUT_FIELD_RET(s, field->ip); | 824 | SEQ_PUT_FIELD(s, field->ip); |
840 | SEQ_PUT_FIELD_RET(s, field->parent_ip); | 825 | SEQ_PUT_FIELD(s, field->parent_ip); |
841 | 826 | ||
842 | return TRACE_TYPE_HANDLED; | 827 | return trace_handle_return(s); |
843 | } | 828 | } |
844 | 829 | ||
845 | static struct trace_event_functions trace_fn_funcs = { | 830 | static struct trace_event_functions trace_fn_funcs = { |
@@ -868,18 +853,17 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter, | |||
868 | T = task_state_char(field->next_state); | 853 | T = task_state_char(field->next_state); |
869 | S = task_state_char(field->prev_state); | 854 | S = task_state_char(field->prev_state); |
870 | trace_find_cmdline(field->next_pid, comm); | 855 | trace_find_cmdline(field->next_pid, comm); |
871 | if (!trace_seq_printf(&iter->seq, | 856 | trace_seq_printf(&iter->seq, |
872 | " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", | 857 | " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", |
873 | field->prev_pid, | 858 | field->prev_pid, |
874 | field->prev_prio, | 859 | field->prev_prio, |
875 | S, delim, | 860 | S, delim, |
876 | field->next_cpu, | 861 | field->next_cpu, |
877 | field->next_pid, | 862 | field->next_pid, |
878 | field->next_prio, | 863 | field->next_prio, |
879 | T, comm)) | 864 | T, comm); |
880 | return TRACE_TYPE_PARTIAL_LINE; | 865 | |
881 | 866 | return trace_handle_return(&iter->seq); | |
882 | return TRACE_TYPE_HANDLED; | ||
883 | } | 867 | } |
884 | 868 | ||
885 | static enum print_line_t trace_ctx_print(struct trace_iterator *iter, int flags, | 869 | static enum print_line_t trace_ctx_print(struct trace_iterator *iter, int flags, |
@@ -904,17 +888,16 @@ static int trace_ctxwake_raw(struct trace_iterator *iter, char S) | |||
904 | if (!S) | 888 | if (!S) |
905 | S = task_state_char(field->prev_state); | 889 | S = task_state_char(field->prev_state); |
906 | T = task_state_char(field->next_state); | 890 | T = task_state_char(field->next_state); |
907 | if (!trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n", | 891 | trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n", |
908 | field->prev_pid, | 892 | field->prev_pid, |
909 | field->prev_prio, | 893 | field->prev_prio, |
910 | S, | 894 | S, |
911 | field->next_cpu, | 895 | field->next_cpu, |
912 | field->next_pid, | 896 | field->next_pid, |
913 | field->next_prio, | 897 | field->next_prio, |
914 | T)) | 898 | T); |
915 | return TRACE_TYPE_PARTIAL_LINE; | 899 | |
916 | 900 | return trace_handle_return(&iter->seq); | |
917 | return TRACE_TYPE_HANDLED; | ||
918 | } | 901 | } |
919 | 902 | ||
920 | static enum print_line_t trace_ctx_raw(struct trace_iterator *iter, int flags, | 903 | static enum print_line_t trace_ctx_raw(struct trace_iterator *iter, int flags, |
@@ -942,15 +925,15 @@ static int trace_ctxwake_hex(struct trace_iterator *iter, char S) | |||
942 | S = task_state_char(field->prev_state); | 925 | S = task_state_char(field->prev_state); |
943 | T = task_state_char(field->next_state); | 926 | T = task_state_char(field->next_state); |
944 | 927 | ||
945 | SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid); | 928 | SEQ_PUT_HEX_FIELD(s, field->prev_pid); |
946 | SEQ_PUT_HEX_FIELD_RET(s, field->prev_prio); | 929 | SEQ_PUT_HEX_FIELD(s, field->prev_prio); |
947 | SEQ_PUT_HEX_FIELD_RET(s, S); | 930 | SEQ_PUT_HEX_FIELD(s, S); |
948 | SEQ_PUT_HEX_FIELD_RET(s, field->next_cpu); | 931 | SEQ_PUT_HEX_FIELD(s, field->next_cpu); |
949 | SEQ_PUT_HEX_FIELD_RET(s, field->next_pid); | 932 | SEQ_PUT_HEX_FIELD(s, field->next_pid); |
950 | SEQ_PUT_HEX_FIELD_RET(s, field->next_prio); | 933 | SEQ_PUT_HEX_FIELD(s, field->next_prio); |
951 | SEQ_PUT_HEX_FIELD_RET(s, T); | 934 | SEQ_PUT_HEX_FIELD(s, T); |
952 | 935 | ||
953 | return TRACE_TYPE_HANDLED; | 936 | return trace_handle_return(s); |
954 | } | 937 | } |
955 | 938 | ||
956 | static enum print_line_t trace_ctx_hex(struct trace_iterator *iter, int flags, | 939 | static enum print_line_t trace_ctx_hex(struct trace_iterator *iter, int flags, |
@@ -973,14 +956,15 @@ static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter, | |||
973 | 956 | ||
974 | trace_assign_type(field, iter->ent); | 957 | trace_assign_type(field, iter->ent); |
975 | 958 | ||
976 | SEQ_PUT_FIELD_RET(s, field->prev_pid); | 959 | SEQ_PUT_FIELD(s, field->prev_pid); |
977 | SEQ_PUT_FIELD_RET(s, field->prev_prio); | 960 | SEQ_PUT_FIELD(s, field->prev_prio); |
978 | SEQ_PUT_FIELD_RET(s, field->prev_state); | 961 | SEQ_PUT_FIELD(s, field->prev_state); |
979 | SEQ_PUT_FIELD_RET(s, field->next_pid); | 962 | SEQ_PUT_FIELD(s, field->next_cpu); |
980 | SEQ_PUT_FIELD_RET(s, field->next_prio); | 963 | SEQ_PUT_FIELD(s, field->next_pid); |
981 | SEQ_PUT_FIELD_RET(s, field->next_state); | 964 | SEQ_PUT_FIELD(s, field->next_prio); |
965 | SEQ_PUT_FIELD(s, field->next_state); | ||
982 | 966 | ||
983 | return TRACE_TYPE_HANDLED; | 967 | return trace_handle_return(s); |
984 | } | 968 | } |
985 | 969 | ||
986 | static struct trace_event_functions trace_ctx_funcs = { | 970 | static struct trace_event_functions trace_ctx_funcs = { |
@@ -1020,23 +1004,19 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, | |||
1020 | trace_assign_type(field, iter->ent); | 1004 | trace_assign_type(field, iter->ent); |
1021 | end = (unsigned long *)((long)iter->ent + iter->ent_size); | 1005 | end = (unsigned long *)((long)iter->ent + iter->ent_size); |
1022 | 1006 | ||
1023 | if (!trace_seq_puts(s, "<stack trace>\n")) | 1007 | trace_seq_puts(s, "<stack trace>\n"); |
1024 | goto partial; | ||
1025 | 1008 | ||
1026 | for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { | 1009 | for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { |
1027 | if (!trace_seq_puts(s, " => ")) | ||
1028 | goto partial; | ||
1029 | 1010 | ||
1030 | if (!seq_print_ip_sym(s, *p, flags)) | 1011 | if (trace_seq_has_overflowed(s)) |
1031 | goto partial; | 1012 | break; |
1032 | if (!trace_seq_putc(s, '\n')) | ||
1033 | goto partial; | ||
1034 | } | ||
1035 | 1013 | ||
1036 | return TRACE_TYPE_HANDLED; | 1014 | trace_seq_puts(s, " => "); |
1015 | seq_print_ip_sym(s, *p, flags); | ||
1016 | trace_seq_putc(s, '\n'); | ||
1017 | } | ||
1037 | 1018 | ||
1038 | partial: | 1019 | return trace_handle_return(s); |
1039 | return TRACE_TYPE_PARTIAL_LINE; | ||
1040 | } | 1020 | } |
1041 | 1021 | ||
1042 | static struct trace_event_functions trace_stack_funcs = { | 1022 | static struct trace_event_functions trace_stack_funcs = { |
@@ -1057,16 +1037,10 @@ static enum print_line_t trace_user_stack_print(struct trace_iterator *iter, | |||
1057 | 1037 | ||
1058 | trace_assign_type(field, iter->ent); | 1038 | trace_assign_type(field, iter->ent); |
1059 | 1039 | ||
1060 | if (!trace_seq_puts(s, "<user stack trace>\n")) | 1040 | trace_seq_puts(s, "<user stack trace>\n"); |
1061 | goto partial; | 1041 | seq_print_userip_objs(field, s, flags); |
1062 | |||
1063 | if (!seq_print_userip_objs(field, s, flags)) | ||
1064 | goto partial; | ||
1065 | |||
1066 | return TRACE_TYPE_HANDLED; | ||
1067 | 1042 | ||
1068 | partial: | 1043 | return trace_handle_return(s); |
1069 | return TRACE_TYPE_PARTIAL_LINE; | ||
1070 | } | 1044 | } |
1071 | 1045 | ||
1072 | static struct trace_event_functions trace_user_stack_funcs = { | 1046 | static struct trace_event_functions trace_user_stack_funcs = { |
@@ -1089,19 +1063,11 @@ trace_bputs_print(struct trace_iterator *iter, int flags, | |||
1089 | 1063 | ||
1090 | trace_assign_type(field, entry); | 1064 | trace_assign_type(field, entry); |
1091 | 1065 | ||
1092 | if (!seq_print_ip_sym(s, field->ip, flags)) | 1066 | seq_print_ip_sym(s, field->ip, flags); |
1093 | goto partial; | 1067 | trace_seq_puts(s, ": "); |
1068 | trace_seq_puts(s, field->str); | ||
1094 | 1069 | ||
1095 | if (!trace_seq_puts(s, ": ")) | 1070 | return trace_handle_return(s); |
1096 | goto partial; | ||
1097 | |||
1098 | if (!trace_seq_puts(s, field->str)) | ||
1099 | goto partial; | ||
1100 | |||
1101 | return TRACE_TYPE_HANDLED; | ||
1102 | |||
1103 | partial: | ||
1104 | return TRACE_TYPE_PARTIAL_LINE; | ||
1105 | } | 1071 | } |
1106 | 1072 | ||
1107 | 1073 | ||
@@ -1114,16 +1080,10 @@ trace_bputs_raw(struct trace_iterator *iter, int flags, | |||
1114 | 1080 | ||
1115 | trace_assign_type(field, iter->ent); | 1081 | trace_assign_type(field, iter->ent); |
1116 | 1082 | ||
1117 | if (!trace_seq_printf(s, ": %lx : ", field->ip)) | 1083 | trace_seq_printf(s, ": %lx : ", field->ip); |
1118 | goto partial; | 1084 | trace_seq_puts(s, field->str); |
1119 | |||
1120 | if (!trace_seq_puts(s, field->str)) | ||
1121 | goto partial; | ||
1122 | 1085 | ||
1123 | return TRACE_TYPE_HANDLED; | 1086 | return trace_handle_return(s); |
1124 | |||
1125 | partial: | ||
1126 | return TRACE_TYPE_PARTIAL_LINE; | ||
1127 | } | 1087 | } |
1128 | 1088 | ||
1129 | static struct trace_event_functions trace_bputs_funcs = { | 1089 | static struct trace_event_functions trace_bputs_funcs = { |
@@ -1147,19 +1107,11 @@ trace_bprint_print(struct trace_iterator *iter, int flags, | |||
1147 | 1107 | ||
1148 | trace_assign_type(field, entry); | 1108 | trace_assign_type(field, entry); |
1149 | 1109 | ||
1150 | if (!seq_print_ip_sym(s, field->ip, flags)) | 1110 | seq_print_ip_sym(s, field->ip, flags); |
1151 | goto partial; | 1111 | trace_seq_puts(s, ": "); |
1152 | 1112 | trace_seq_bprintf(s, field->fmt, field->buf); | |
1153 | if (!trace_seq_puts(s, ": ")) | ||
1154 | goto partial; | ||
1155 | |||
1156 | if (!trace_seq_bprintf(s, field->fmt, field->buf)) | ||
1157 | goto partial; | ||
1158 | 1113 | ||
1159 | return TRACE_TYPE_HANDLED; | 1114 | return trace_handle_return(s); |
1160 | |||
1161 | partial: | ||
1162 | return TRACE_TYPE_PARTIAL_LINE; | ||
1163 | } | 1115 | } |
1164 | 1116 | ||
1165 | 1117 | ||
@@ -1172,16 +1124,10 @@ trace_bprint_raw(struct trace_iterator *iter, int flags, | |||
1172 | 1124 | ||
1173 | trace_assign_type(field, iter->ent); | 1125 | trace_assign_type(field, iter->ent); |
1174 | 1126 | ||
1175 | if (!trace_seq_printf(s, ": %lx : ", field->ip)) | 1127 | trace_seq_printf(s, ": %lx : ", field->ip); |
1176 | goto partial; | 1128 | trace_seq_bprintf(s, field->fmt, field->buf); |
1177 | |||
1178 | if (!trace_seq_bprintf(s, field->fmt, field->buf)) | ||
1179 | goto partial; | ||
1180 | 1129 | ||
1181 | return TRACE_TYPE_HANDLED; | 1130 | return trace_handle_return(s); |
1182 | |||
1183 | partial: | ||
1184 | return TRACE_TYPE_PARTIAL_LINE; | ||
1185 | } | 1131 | } |
1186 | 1132 | ||
1187 | static struct trace_event_functions trace_bprint_funcs = { | 1133 | static struct trace_event_functions trace_bprint_funcs = { |
@@ -1203,16 +1149,10 @@ static enum print_line_t trace_print_print(struct trace_iterator *iter, | |||
1203 | 1149 | ||
1204 | trace_assign_type(field, iter->ent); | 1150 | trace_assign_type(field, iter->ent); |
1205 | 1151 | ||
1206 | if (!seq_print_ip_sym(s, field->ip, flags)) | 1152 | seq_print_ip_sym(s, field->ip, flags); |
1207 | goto partial; | 1153 | trace_seq_printf(s, ": %s", field->buf); |
1208 | |||
1209 | if (!trace_seq_printf(s, ": %s", field->buf)) | ||
1210 | goto partial; | ||
1211 | 1154 | ||
1212 | return TRACE_TYPE_HANDLED; | 1155 | return trace_handle_return(s); |
1213 | |||
1214 | partial: | ||
1215 | return TRACE_TYPE_PARTIAL_LINE; | ||
1216 | } | 1156 | } |
1217 | 1157 | ||
1218 | static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags, | 1158 | static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags, |
@@ -1222,13 +1162,9 @@ static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags, | |||
1222 | 1162 | ||
1223 | trace_assign_type(field, iter->ent); | 1163 | trace_assign_type(field, iter->ent); |
1224 | 1164 | ||
1225 | if (!trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf)) | 1165 | trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf); |
1226 | goto partial; | ||
1227 | |||
1228 | return TRACE_TYPE_HANDLED; | ||
1229 | 1166 | ||
1230 | partial: | 1167 | return trace_handle_return(&iter->seq); |
1231 | return TRACE_TYPE_PARTIAL_LINE; | ||
1232 | } | 1168 | } |
1233 | 1169 | ||
1234 | static struct trace_event_functions trace_print_funcs = { | 1170 | static struct trace_event_functions trace_print_funcs = { |