| .. | .. |
|---|
| 20 | 20 | |
|---|
| 21 | 21 | static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly; |
|---|
| 22 | 22 | |
|---|
| 23 | | -static int next_event_type = __TRACE_LAST_TYPE + 1; |
|---|
| 23 | +static int next_event_type = __TRACE_LAST_TYPE; |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | enum print_line_t trace_print_bputs_msg_only(struct trace_iterator *iter) |
|---|
| 26 | 26 | { |
|---|
| .. | .. |
|---|
| 219 | 219 | { |
|---|
| 220 | 220 | int i; |
|---|
| 221 | 221 | const char *ret = trace_seq_buffer_ptr(p); |
|---|
| 222 | + const char *fmt = concatenate ? "%*phN" : "%*ph"; |
|---|
| 222 | 223 | |
|---|
| 223 | | - for (i = 0; i < buf_len; i++) |
|---|
| 224 | | - trace_seq_printf(p, "%s%2.2x", concatenate || i == 0 ? "" : " ", |
|---|
| 225 | | - buf[i]); |
|---|
| 224 | + for (i = 0; i < buf_len; i += 16) |
|---|
| 225 | + trace_seq_printf(p, fmt, min(buf_len - i, 16), &buf[i]); |
|---|
| 226 | 226 | trace_seq_putc(p, 0); |
|---|
| 227 | 227 | |
|---|
| 228 | 228 | return ret; |
|---|
| .. | .. |
|---|
| 273 | 273 | return ret; |
|---|
| 274 | 274 | } |
|---|
| 275 | 275 | EXPORT_SYMBOL(trace_print_array_seq); |
|---|
| 276 | + |
|---|
| 277 | +const char * |
|---|
| 278 | +trace_print_hex_dump_seq(struct trace_seq *p, const char *prefix_str, |
|---|
| 279 | + int prefix_type, int rowsize, int groupsize, |
|---|
| 280 | + const void *buf, size_t len, bool ascii) |
|---|
| 281 | +{ |
|---|
| 282 | + const char *ret = trace_seq_buffer_ptr(p); |
|---|
| 283 | + |
|---|
| 284 | + trace_seq_putc(p, '\n'); |
|---|
| 285 | + trace_seq_hex_dump(p, prefix_str, prefix_type, |
|---|
| 286 | + rowsize, groupsize, buf, len, ascii); |
|---|
| 287 | + trace_seq_putc(p, 0); |
|---|
| 288 | + return ret; |
|---|
| 289 | +} |
|---|
| 290 | +EXPORT_SYMBOL(trace_print_hex_dump_seq); |
|---|
| 276 | 291 | |
|---|
| 277 | 292 | int trace_raw_output_prep(struct trace_iterator *iter, |
|---|
| 278 | 293 | struct trace_event *trace_event) |
|---|
| .. | .. |
|---|
| 339 | 354 | #endif /* CONFIG_KRETPROBES */ |
|---|
| 340 | 355 | |
|---|
| 341 | 356 | static void |
|---|
| 342 | | -seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) |
|---|
| 357 | +seq_print_sym(struct trace_seq *s, unsigned long address, bool offset) |
|---|
| 343 | 358 | { |
|---|
| 344 | | - char str[KSYM_SYMBOL_LEN]; |
|---|
| 345 | 359 | #ifdef CONFIG_KALLSYMS |
|---|
| 360 | + char str[KSYM_SYMBOL_LEN]; |
|---|
| 346 | 361 | const char *name; |
|---|
| 347 | 362 | |
|---|
| 348 | | - kallsyms_lookup(address, NULL, NULL, NULL, str); |
|---|
| 349 | | - |
|---|
| 363 | + if (offset) |
|---|
| 364 | + sprint_symbol(str, address); |
|---|
| 365 | + else |
|---|
| 366 | + kallsyms_lookup(address, NULL, NULL, NULL, str); |
|---|
| 350 | 367 | name = kretprobed(str); |
|---|
| 351 | 368 | |
|---|
| 352 | 369 | if (name && strlen(name)) { |
|---|
| 353 | | - trace_seq_printf(s, fmt, name); |
|---|
| 370 | + trace_seq_puts(s, name); |
|---|
| 354 | 371 | return; |
|---|
| 355 | 372 | } |
|---|
| 356 | 373 | #endif |
|---|
| 357 | | - snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address); |
|---|
| 358 | | - trace_seq_printf(s, fmt, str); |
|---|
| 359 | | -} |
|---|
| 360 | | - |
|---|
| 361 | | -static void |
|---|
| 362 | | -seq_print_sym_offset(struct trace_seq *s, const char *fmt, |
|---|
| 363 | | - unsigned long address) |
|---|
| 364 | | -{ |
|---|
| 365 | | - char str[KSYM_SYMBOL_LEN]; |
|---|
| 366 | | -#ifdef CONFIG_KALLSYMS |
|---|
| 367 | | - const char *name; |
|---|
| 368 | | - |
|---|
| 369 | | - sprint_symbol(str, address); |
|---|
| 370 | | - name = kretprobed(str); |
|---|
| 371 | | - |
|---|
| 372 | | - if (name && strlen(name)) { |
|---|
| 373 | | - trace_seq_printf(s, fmt, name); |
|---|
| 374 | | - return; |
|---|
| 375 | | - } |
|---|
| 376 | | -#endif |
|---|
| 377 | | - snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address); |
|---|
| 378 | | - trace_seq_printf(s, fmt, str); |
|---|
| 374 | + trace_seq_printf(s, "0x%08lx", address); |
|---|
| 379 | 375 | } |
|---|
| 380 | 376 | |
|---|
| 381 | 377 | #ifndef CONFIG_64BIT |
|---|
| .. | .. |
|---|
| 397 | 393 | if (mm) { |
|---|
| 398 | 394 | const struct vm_area_struct *vma; |
|---|
| 399 | 395 | |
|---|
| 400 | | - down_read(&mm->mmap_sem); |
|---|
| 396 | + mmap_read_lock(mm); |
|---|
| 401 | 397 | vma = find_vma(mm, ip); |
|---|
| 402 | 398 | if (vma) { |
|---|
| 403 | 399 | file = vma->vm_file; |
|---|
| .. | .. |
|---|
| 409 | 405 | trace_seq_printf(s, "[+0x%lx]", |
|---|
| 410 | 406 | ip - vmstart); |
|---|
| 411 | 407 | } |
|---|
| 412 | | - up_read(&mm->mmap_sem); |
|---|
| 408 | + mmap_read_unlock(mm); |
|---|
| 413 | 409 | } |
|---|
| 414 | 410 | if (ret && ((sym_flags & TRACE_ITER_SYM_ADDR) || !file)) |
|---|
| 415 | 411 | trace_seq_printf(s, " <" IP_FMT ">", ip); |
|---|
| .. | .. |
|---|
| 424 | 420 | goto out; |
|---|
| 425 | 421 | } |
|---|
| 426 | 422 | |
|---|
| 427 | | - if (sym_flags & TRACE_ITER_SYM_OFFSET) |
|---|
| 428 | | - seq_print_sym_offset(s, "%s", ip); |
|---|
| 429 | | - else |
|---|
| 430 | | - seq_print_sym_short(s, "%s", ip); |
|---|
| 423 | + seq_print_sym(s, ip, sym_flags & TRACE_ITER_SYM_OFFSET); |
|---|
| 431 | 424 | |
|---|
| 432 | 425 | if (sym_flags & TRACE_ITER_SYM_ADDR) |
|---|
| 433 | 426 | trace_seq_printf(s, " <" IP_FMT ">", ip); |
|---|
| .. | .. |
|---|
| 448 | 441 | { |
|---|
| 449 | 442 | char hardsoft_irq; |
|---|
| 450 | 443 | char need_resched; |
|---|
| 451 | | - char need_resched_lazy; |
|---|
| 452 | 444 | char irqs_off; |
|---|
| 453 | 445 | int hardirq; |
|---|
| 454 | 446 | int softirq; |
|---|
| .. | .. |
|---|
| 479 | 471 | break; |
|---|
| 480 | 472 | } |
|---|
| 481 | 473 | |
|---|
| 482 | | - need_resched_lazy = |
|---|
| 483 | | - (entry->flags & TRACE_FLAG_NEED_RESCHED_LAZY) ? 'L' : '.'; |
|---|
| 484 | | - |
|---|
| 485 | 474 | hardsoft_irq = |
|---|
| 486 | 475 | (nmi && hardirq) ? 'Z' : |
|---|
| 487 | 476 | nmi ? 'z' : |
|---|
| .. | .. |
|---|
| 490 | 479 | softirq ? 's' : |
|---|
| 491 | 480 | '.' ; |
|---|
| 492 | 481 | |
|---|
| 493 | | - trace_seq_printf(s, "%c%c%c%c", |
|---|
| 494 | | - irqs_off, need_resched, need_resched_lazy, |
|---|
| 495 | | - hardsoft_irq); |
|---|
| 482 | + trace_seq_printf(s, "%c%c%c", |
|---|
| 483 | + irqs_off, need_resched, hardsoft_irq); |
|---|
| 496 | 484 | |
|---|
| 497 | 485 | if (entry->preempt_count) |
|---|
| 498 | 486 | trace_seq_printf(s, "%x", entry->preempt_count); |
|---|
| 499 | | - else |
|---|
| 500 | | - trace_seq_putc(s, '.'); |
|---|
| 501 | | - |
|---|
| 502 | | - if (entry->preempt_lazy_count) |
|---|
| 503 | | - trace_seq_printf(s, "%x", entry->preempt_lazy_count); |
|---|
| 504 | | - else |
|---|
| 505 | | - trace_seq_putc(s, '.'); |
|---|
| 506 | | - |
|---|
| 507 | | - if (entry->migrate_disable) |
|---|
| 508 | | - trace_seq_printf(s, "%x", entry->migrate_disable); |
|---|
| 509 | 487 | else |
|---|
| 510 | 488 | trace_seq_putc(s, '.'); |
|---|
| 511 | 489 | |
|---|
| .. | .. |
|---|
| 519 | 497 | |
|---|
| 520 | 498 | trace_find_cmdline(entry->pid, comm); |
|---|
| 521 | 499 | |
|---|
| 522 | | - trace_seq_printf(s, "%8.8s-%-5d %3d", |
|---|
| 500 | + trace_seq_printf(s, "%8.8s-%-7d %3d", |
|---|
| 523 | 501 | comm, entry->pid, cpu); |
|---|
| 524 | 502 | |
|---|
| 525 | 503 | return trace_print_lat_fmt(s, entry); |
|---|
| .. | .. |
|---|
| 560 | 538 | struct trace_array *tr = iter->tr; |
|---|
| 561 | 539 | unsigned long verbose = tr->trace_flags & TRACE_ITER_VERBOSE; |
|---|
| 562 | 540 | unsigned long in_ns = iter->iter_flags & TRACE_FILE_TIME_IN_NS; |
|---|
| 563 | | - unsigned long long abs_ts = iter->ts - iter->trace_buffer->time_start; |
|---|
| 541 | + unsigned long long abs_ts = iter->ts - iter->array_buffer->time_start; |
|---|
| 564 | 542 | unsigned long long rel_ts = next_ts - iter->ts; |
|---|
| 565 | 543 | struct trace_seq *s = &iter->seq; |
|---|
| 566 | 544 | |
|---|
| .. | .. |
|---|
| 610 | 588 | |
|---|
| 611 | 589 | trace_find_cmdline(entry->pid, comm); |
|---|
| 612 | 590 | |
|---|
| 613 | | - trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); |
|---|
| 591 | + trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid); |
|---|
| 614 | 592 | |
|---|
| 615 | 593 | if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { |
|---|
| 616 | 594 | unsigned int tgid = trace_find_tgid(entry->pid); |
|---|
| 617 | 595 | |
|---|
| 618 | 596 | if (!tgid) |
|---|
| 619 | | - trace_seq_printf(s, "(-----) "); |
|---|
| 597 | + trace_seq_printf(s, "(-------) "); |
|---|
| 620 | 598 | else |
|---|
| 621 | | - trace_seq_printf(s, "(%5d) ", tgid); |
|---|
| 599 | + trace_seq_printf(s, "(%7d) ", tgid); |
|---|
| 622 | 600 | } |
|---|
| 623 | 601 | |
|---|
| 624 | 602 | trace_seq_printf(s, "[%03d] ", iter->cpu); |
|---|
| .. | .. |
|---|
| 639 | 617 | |
|---|
| 640 | 618 | int trace_print_lat_context(struct trace_iterator *iter) |
|---|
| 641 | 619 | { |
|---|
| 620 | + struct trace_entry *entry, *next_entry; |
|---|
| 642 | 621 | struct trace_array *tr = iter->tr; |
|---|
| 643 | | - /* trace_find_next_entry will reset ent_size */ |
|---|
| 644 | | - int ent_size = iter->ent_size; |
|---|
| 645 | 622 | struct trace_seq *s = &iter->seq; |
|---|
| 646 | | - u64 next_ts; |
|---|
| 647 | | - struct trace_entry *entry = iter->ent, |
|---|
| 648 | | - *next_entry = trace_find_next_entry(iter, NULL, |
|---|
| 649 | | - &next_ts); |
|---|
| 650 | 623 | unsigned long verbose = (tr->trace_flags & TRACE_ITER_VERBOSE); |
|---|
| 624 | + u64 next_ts; |
|---|
| 651 | 625 | |
|---|
| 652 | | - /* Restore the original ent_size */ |
|---|
| 653 | | - iter->ent_size = ent_size; |
|---|
| 654 | | - |
|---|
| 626 | + next_entry = trace_find_next_entry(iter, NULL, &next_ts); |
|---|
| 655 | 627 | if (!next_entry) |
|---|
| 656 | 628 | next_ts = iter->ts; |
|---|
| 629 | + |
|---|
| 630 | + /* trace_find_next_entry() may change iter->ent */ |
|---|
| 631 | + entry = iter->ent; |
|---|
| 657 | 632 | |
|---|
| 658 | 633 | if (verbose) { |
|---|
| 659 | 634 | char comm[TASK_COMM_LEN]; |
|---|
| .. | .. |
|---|
| 661 | 636 | trace_find_cmdline(entry->pid, comm); |
|---|
| 662 | 637 | |
|---|
| 663 | 638 | trace_seq_printf( |
|---|
| 664 | | - s, "%16s %5d %3d %d %08x %08lx ", |
|---|
| 639 | + s, "%16s %7d %3d %d %08x %08lx ", |
|---|
| 665 | 640 | comm, entry->pid, iter->cpu, entry->flags, |
|---|
| 666 | 641 | entry->preempt_count, iter->idx); |
|---|
| 667 | 642 | } else { |
|---|
| .. | .. |
|---|
| 700 | 675 | static int trace_search_list(struct list_head **list) |
|---|
| 701 | 676 | { |
|---|
| 702 | 677 | struct trace_event *e; |
|---|
| 703 | | - int last = __TRACE_LAST_TYPE; |
|---|
| 678 | + int next = __TRACE_LAST_TYPE; |
|---|
| 704 | 679 | |
|---|
| 705 | 680 | if (list_empty(&ftrace_event_list)) { |
|---|
| 706 | 681 | *list = &ftrace_event_list; |
|---|
| 707 | | - return last + 1; |
|---|
| 682 | + return next; |
|---|
| 708 | 683 | } |
|---|
| 709 | 684 | |
|---|
| 710 | 685 | /* |
|---|
| .. | .. |
|---|
| 712 | 687 | * lets see if somebody freed one. |
|---|
| 713 | 688 | */ |
|---|
| 714 | 689 | list_for_each_entry(e, &ftrace_event_list, list) { |
|---|
| 715 | | - if (e->type != last + 1) |
|---|
| 690 | + if (e->type != next) |
|---|
| 716 | 691 | break; |
|---|
| 717 | | - last++; |
|---|
| 692 | + next++; |
|---|
| 718 | 693 | } |
|---|
| 719 | 694 | |
|---|
| 720 | 695 | /* Did we used up all 65 thousand events??? */ |
|---|
| 721 | | - if ((last + 1) > TRACE_EVENT_TYPE_MAX) |
|---|
| 696 | + if (next > TRACE_EVENT_TYPE_MAX) |
|---|
| 722 | 697 | return 0; |
|---|
| 723 | 698 | |
|---|
| 724 | 699 | *list = &e->list; |
|---|
| 725 | | - return last + 1; |
|---|
| 700 | + return next; |
|---|
| 726 | 701 | } |
|---|
| 727 | 702 | |
|---|
| 728 | 703 | void trace_event_read_lock(void) |
|---|
| .. | .. |
|---|
| 942 | 917 | S = task_index_to_char(field->prev_state); |
|---|
| 943 | 918 | trace_find_cmdline(field->next_pid, comm); |
|---|
| 944 | 919 | trace_seq_printf(&iter->seq, |
|---|
| 945 | | - " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", |
|---|
| 920 | + " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n", |
|---|
| 946 | 921 | field->prev_pid, |
|---|
| 947 | 922 | field->prev_prio, |
|---|
| 948 | 923 | S, delim, |
|---|
| .. | .. |
|---|
| 1094 | 1069 | |
|---|
| 1095 | 1070 | trace_seq_puts(s, "<stack trace>\n"); |
|---|
| 1096 | 1071 | |
|---|
| 1097 | | - for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { |
|---|
| 1072 | + for (p = field->caller; p && p < end && *p != ULONG_MAX; p++) { |
|---|
| 1098 | 1073 | |
|---|
| 1099 | 1074 | if (trace_seq_has_overflowed(s)) |
|---|
| 1100 | 1075 | break; |
|---|
| .. | .. |
|---|
| 1146 | 1121 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { |
|---|
| 1147 | 1122 | unsigned long ip = field->caller[i]; |
|---|
| 1148 | 1123 | |
|---|
| 1149 | | - if (ip == ULONG_MAX || trace_seq_has_overflowed(s)) |
|---|
| 1124 | + if (!ip || trace_seq_has_overflowed(s)) |
|---|
| 1150 | 1125 | break; |
|---|
| 1151 | 1126 | |
|---|
| 1152 | 1127 | trace_seq_puts(s, " => "); |
|---|
| 1153 | | - |
|---|
| 1154 | | - if (!ip) { |
|---|
| 1155 | | - trace_seq_puts(s, "??"); |
|---|
| 1156 | | - trace_seq_putc(s, '\n'); |
|---|
| 1157 | | - continue; |
|---|
| 1158 | | - } |
|---|
| 1159 | | - |
|---|
| 1160 | 1128 | seq_print_user_ip(s, mm, ip, flags); |
|---|
| 1161 | 1129 | trace_seq_putc(s, '\n'); |
|---|
| 1162 | 1130 | } |
|---|
| .. | .. |
|---|
| 1187 | 1155 | |
|---|
| 1188 | 1156 | trace_assign_type(field, entry); |
|---|
| 1189 | 1157 | |
|---|
| 1190 | | - trace_seq_printf(s, "#%-5u inner/outer(us): %4llu/%-5llu ts:%lld.%09ld", |
|---|
| 1158 | + trace_seq_printf(s, "#%-5u inner/outer(us): %4llu/%-5llu ts:%lld.%09ld count:%d", |
|---|
| 1191 | 1159 | field->seqnum, |
|---|
| 1192 | 1160 | field->duration, |
|---|
| 1193 | 1161 | field->outer_duration, |
|---|
| 1194 | 1162 | (long long)field->timestamp.tv_sec, |
|---|
| 1195 | | - field->timestamp.tv_nsec); |
|---|
| 1163 | + field->timestamp.tv_nsec, field->count); |
|---|
| 1196 | 1164 | |
|---|
| 1197 | 1165 | if (field->nmi_count) { |
|---|
| 1198 | 1166 | /* |
|---|
| .. | .. |
|---|
| 1410 | 1378 | NULL |
|---|
| 1411 | 1379 | }; |
|---|
| 1412 | 1380 | |
|---|
| 1413 | | -__init static int init_events(void) |
|---|
| 1381 | +__init int init_events(void) |
|---|
| 1414 | 1382 | { |
|---|
| 1415 | 1383 | struct trace_event *event; |
|---|
| 1416 | 1384 | int i, ret; |
|---|
| .. | .. |
|---|
| 1428 | 1396 | |
|---|
| 1429 | 1397 | return 0; |
|---|
| 1430 | 1398 | } |
|---|
| 1431 | | -early_initcall(init_events); |
|---|