diff options
Diffstat (limited to 'kernel/trace/trace_output.c')
| -rw-r--r-- | kernel/trace/trace_output.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index e0c2545622e8..b6c12c6a1bcd 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
| @@ -69,6 +69,9 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter) | |||
| 69 | * @s: trace sequence descriptor | 69 | * @s: trace sequence descriptor |
| 70 | * @fmt: printf format string | 70 | * @fmt: printf format string |
| 71 | * | 71 | * |
| 72 | * It returns 0 if the trace oversizes the buffer's free | ||
| 73 | * space, 1 otherwise. | ||
| 74 | * | ||
| 72 | * The tracer may use either sequence operations or its own | 75 | * The tracer may use either sequence operations or its own |
| 73 | * copy to user routines. To simplify formating of a trace | 76 | * copy to user routines. To simplify formating of a trace |
| 74 | * trace_seq_printf is used to store strings into a special | 77 | * trace_seq_printf is used to store strings into a special |
| @@ -95,7 +98,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | |||
| 95 | 98 | ||
| 96 | s->len += ret; | 99 | s->len += ret; |
| 97 | 100 | ||
| 98 | return len; | 101 | return 1; |
| 99 | } | 102 | } |
| 100 | EXPORT_SYMBOL_GPL(trace_seq_printf); | 103 | EXPORT_SYMBOL_GPL(trace_seq_printf); |
| 101 | 104 | ||
| @@ -407,7 +410,7 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s, | |||
| 407 | * since individual threads might have already quit! | 410 | * since individual threads might have already quit! |
| 408 | */ | 411 | */ |
| 409 | rcu_read_lock(); | 412 | rcu_read_lock(); |
| 410 | task = find_task_by_vpid(entry->ent.tgid); | 413 | task = find_task_by_vpid(entry->tgid); |
| 411 | if (task) | 414 | if (task) |
| 412 | mm = get_task_mm(task); | 415 | mm = get_task_mm(task); |
| 413 | rcu_read_unlock(); | 416 | rcu_read_unlock(); |
| @@ -460,18 +463,23 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) | |||
| 460 | return ret; | 463 | return ret; |
| 461 | } | 464 | } |
| 462 | 465 | ||
| 463 | static int | 466 | /** |
| 464 | lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) | 467 | * trace_print_lat_fmt - print the irq, preempt and lockdep fields |
| 468 | * @s: trace seq struct to write to | ||
| 469 | * @entry: The trace entry field from the ring buffer | ||
| 470 | * | ||
| 471 | * Prints the generic fields of irqs off, in hard or softirq, preempt | ||
| 472 | * count and lock depth. | ||
| 473 | */ | ||
| 474 | int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) | ||
| 465 | { | 475 | { |
| 466 | int hardirq, softirq; | 476 | int hardirq, softirq; |
| 467 | char comm[TASK_COMM_LEN]; | 477 | int ret; |
| 468 | 478 | ||
| 469 | trace_find_cmdline(entry->pid, comm); | ||
| 470 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; | 479 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; |
| 471 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; | 480 | softirq = entry->flags & TRACE_FLAG_SOFTIRQ; |
| 472 | 481 | ||
| 473 | if (!trace_seq_printf(s, "%8.8s-%-5d %3d%c%c%c", | 482 | if (!trace_seq_printf(s, "%c%c%c", |
| 474 | comm, entry->pid, cpu, | ||
| 475 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : | 483 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : |
| 476 | (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? | 484 | (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? |
| 477 | 'X' : '.', | 485 | 'X' : '.', |
| @@ -482,8 +490,31 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) | |||
| 482 | return 0; | 490 | return 0; |
| 483 | 491 | ||
| 484 | if (entry->preempt_count) | 492 | if (entry->preempt_count) |
| 485 | return trace_seq_printf(s, "%x", entry->preempt_count); | 493 | ret = trace_seq_printf(s, "%x", entry->preempt_count); |
| 486 | return trace_seq_puts(s, "."); | 494 | else |
| 495 | ret = trace_seq_putc(s, '.'); | ||
| 496 | |||
| 497 | if (!ret) | ||
| 498 | return 0; | ||
| 499 | |||
| 500 | if (entry->lock_depth < 0) | ||
| 501 | return trace_seq_putc(s, '.'); | ||
| 502 | |||
| 503 | return trace_seq_printf(s, "%d", entry->lock_depth); | ||
| 504 | } | ||
| 505 | |||
| 506 | static int | ||
| 507 | lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) | ||
| 508 | { | ||
| 509 | char comm[TASK_COMM_LEN]; | ||
| 510 | |||
| 511 | trace_find_cmdline(entry->pid, comm); | ||
| 512 | |||
| 513 | if (!trace_seq_printf(s, "%8.8s-%-5d %3d", | ||
| 514 | comm, entry->pid, cpu)) | ||
| 515 | return 0; | ||
| 516 | |||
| 517 | return trace_print_lat_fmt(s, entry); | ||
| 487 | } | 518 | } |
| 488 | 519 | ||
| 489 | static unsigned long preempt_mark_thresh = 100; | 520 | static unsigned long preempt_mark_thresh = 100; |
| @@ -857,7 +888,7 @@ static int trace_ctxwake_raw(struct trace_iterator *iter, char S) | |||
| 857 | trace_assign_type(field, iter->ent); | 888 | trace_assign_type(field, iter->ent); |
| 858 | 889 | ||
| 859 | if (!S) | 890 | if (!S) |
| 860 | task_state_char(field->prev_state); | 891 | S = task_state_char(field->prev_state); |
| 861 | T = task_state_char(field->next_state); | 892 | T = task_state_char(field->next_state); |
| 862 | if (!trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n", | 893 | if (!trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n", |
| 863 | field->prev_pid, | 894 | field->prev_pid, |
| @@ -892,7 +923,7 @@ static int trace_ctxwake_hex(struct trace_iterator *iter, char S) | |||
| 892 | trace_assign_type(field, iter->ent); | 923 | trace_assign_type(field, iter->ent); |
| 893 | 924 | ||
| 894 | if (!S) | 925 | if (!S) |
| 895 | task_state_char(field->prev_state); | 926 | S = task_state_char(field->prev_state); |
| 896 | T = task_state_char(field->next_state); | 927 | T = task_state_char(field->next_state); |
| 897 | 928 | ||
| 898 | SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid); | 929 | SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid); |
