.. | .. |
---|
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); |
---|
.. | .. |
---|
519 | 512 | |
---|
520 | 513 | trace_find_cmdline(entry->pid, comm); |
---|
521 | 514 | |
---|
522 | | - trace_seq_printf(s, "%8.8s-%-5d %3d", |
---|
| 515 | + trace_seq_printf(s, "%8.8s-%-7d %3d", |
---|
523 | 516 | comm, entry->pid, cpu); |
---|
524 | 517 | |
---|
525 | 518 | return trace_print_lat_fmt(s, entry); |
---|
.. | .. |
---|
560 | 553 | struct trace_array *tr = iter->tr; |
---|
561 | 554 | unsigned long verbose = tr->trace_flags & TRACE_ITER_VERBOSE; |
---|
562 | 555 | 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; |
---|
| 556 | + unsigned long long abs_ts = iter->ts - iter->array_buffer->time_start; |
---|
564 | 557 | unsigned long long rel_ts = next_ts - iter->ts; |
---|
565 | 558 | struct trace_seq *s = &iter->seq; |
---|
566 | 559 | |
---|
.. | .. |
---|
610 | 603 | |
---|
611 | 604 | trace_find_cmdline(entry->pid, comm); |
---|
612 | 605 | |
---|
613 | | - trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); |
---|
| 606 | + trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid); |
---|
614 | 607 | |
---|
615 | 608 | if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { |
---|
616 | 609 | unsigned int tgid = trace_find_tgid(entry->pid); |
---|
617 | 610 | |
---|
618 | 611 | if (!tgid) |
---|
619 | | - trace_seq_printf(s, "(-----) "); |
---|
| 612 | + trace_seq_printf(s, "(-------) "); |
---|
620 | 613 | else |
---|
621 | | - trace_seq_printf(s, "(%5d) ", tgid); |
---|
| 614 | + trace_seq_printf(s, "(%7d) ", tgid); |
---|
622 | 615 | } |
---|
623 | 616 | |
---|
624 | 617 | trace_seq_printf(s, "[%03d] ", iter->cpu); |
---|
.. | .. |
---|
639 | 632 | |
---|
640 | 633 | int trace_print_lat_context(struct trace_iterator *iter) |
---|
641 | 634 | { |
---|
| 635 | + struct trace_entry *entry, *next_entry; |
---|
642 | 636 | struct trace_array *tr = iter->tr; |
---|
643 | | - /* trace_find_next_entry will reset ent_size */ |
---|
644 | | - int ent_size = iter->ent_size; |
---|
645 | 637 | 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 | 638 | unsigned long verbose = (tr->trace_flags & TRACE_ITER_VERBOSE); |
---|
| 639 | + u64 next_ts; |
---|
651 | 640 | |
---|
652 | | - /* Restore the original ent_size */ |
---|
653 | | - iter->ent_size = ent_size; |
---|
654 | | - |
---|
| 641 | + next_entry = trace_find_next_entry(iter, NULL, &next_ts); |
---|
655 | 642 | if (!next_entry) |
---|
656 | 643 | next_ts = iter->ts; |
---|
| 644 | + |
---|
| 645 | + /* trace_find_next_entry() may change iter->ent */ |
---|
| 646 | + entry = iter->ent; |
---|
657 | 647 | |
---|
658 | 648 | if (verbose) { |
---|
659 | 649 | char comm[TASK_COMM_LEN]; |
---|
.. | .. |
---|
661 | 651 | trace_find_cmdline(entry->pid, comm); |
---|
662 | 652 | |
---|
663 | 653 | trace_seq_printf( |
---|
664 | | - s, "%16s %5d %3d %d %08x %08lx ", |
---|
| 654 | + s, "%16s %7d %3d %d %08x %08lx ", |
---|
665 | 655 | comm, entry->pid, iter->cpu, entry->flags, |
---|
666 | 656 | entry->preempt_count, iter->idx); |
---|
667 | 657 | } else { |
---|
.. | .. |
---|
700 | 690 | static int trace_search_list(struct list_head **list) |
---|
701 | 691 | { |
---|
702 | 692 | struct trace_event *e; |
---|
703 | | - int last = __TRACE_LAST_TYPE; |
---|
| 693 | + int next = __TRACE_LAST_TYPE; |
---|
704 | 694 | |
---|
705 | 695 | if (list_empty(&ftrace_event_list)) { |
---|
706 | 696 | *list = &ftrace_event_list; |
---|
707 | | - return last + 1; |
---|
| 697 | + return next; |
---|
708 | 698 | } |
---|
709 | 699 | |
---|
710 | 700 | /* |
---|
.. | .. |
---|
712 | 702 | * lets see if somebody freed one. |
---|
713 | 703 | */ |
---|
714 | 704 | list_for_each_entry(e, &ftrace_event_list, list) { |
---|
715 | | - if (e->type != last + 1) |
---|
| 705 | + if (e->type != next) |
---|
716 | 706 | break; |
---|
717 | | - last++; |
---|
| 707 | + next++; |
---|
718 | 708 | } |
---|
719 | 709 | |
---|
720 | 710 | /* Did we used up all 65 thousand events??? */ |
---|
721 | | - if ((last + 1) > TRACE_EVENT_TYPE_MAX) |
---|
| 711 | + if (next > TRACE_EVENT_TYPE_MAX) |
---|
722 | 712 | return 0; |
---|
723 | 713 | |
---|
724 | 714 | *list = &e->list; |
---|
725 | | - return last + 1; |
---|
| 715 | + return next; |
---|
726 | 716 | } |
---|
727 | 717 | |
---|
728 | 718 | void trace_event_read_lock(void) |
---|
.. | .. |
---|
942 | 932 | S = task_index_to_char(field->prev_state); |
---|
943 | 933 | trace_find_cmdline(field->next_pid, comm); |
---|
944 | 934 | trace_seq_printf(&iter->seq, |
---|
945 | | - " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", |
---|
| 935 | + " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n", |
---|
946 | 936 | field->prev_pid, |
---|
947 | 937 | field->prev_prio, |
---|
948 | 938 | S, delim, |
---|
.. | .. |
---|
1094 | 1084 | |
---|
1095 | 1085 | trace_seq_puts(s, "<stack trace>\n"); |
---|
1096 | 1086 | |
---|
1097 | | - for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { |
---|
| 1087 | + for (p = field->caller; p && p < end && *p != ULONG_MAX; p++) { |
---|
1098 | 1088 | |
---|
1099 | 1089 | if (trace_seq_has_overflowed(s)) |
---|
1100 | 1090 | break; |
---|
.. | .. |
---|
1146 | 1136 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { |
---|
1147 | 1137 | unsigned long ip = field->caller[i]; |
---|
1148 | 1138 | |
---|
1149 | | - if (ip == ULONG_MAX || trace_seq_has_overflowed(s)) |
---|
| 1139 | + if (!ip || trace_seq_has_overflowed(s)) |
---|
1150 | 1140 | break; |
---|
1151 | 1141 | |
---|
1152 | 1142 | trace_seq_puts(s, " => "); |
---|
1153 | | - |
---|
1154 | | - if (!ip) { |
---|
1155 | | - trace_seq_puts(s, "??"); |
---|
1156 | | - trace_seq_putc(s, '\n'); |
---|
1157 | | - continue; |
---|
1158 | | - } |
---|
1159 | | - |
---|
1160 | 1143 | seq_print_user_ip(s, mm, ip, flags); |
---|
1161 | 1144 | trace_seq_putc(s, '\n'); |
---|
1162 | 1145 | } |
---|
.. | .. |
---|
1187 | 1170 | |
---|
1188 | 1171 | trace_assign_type(field, entry); |
---|
1189 | 1172 | |
---|
1190 | | - trace_seq_printf(s, "#%-5u inner/outer(us): %4llu/%-5llu ts:%lld.%09ld", |
---|
| 1173 | + trace_seq_printf(s, "#%-5u inner/outer(us): %4llu/%-5llu ts:%lld.%09ld count:%d", |
---|
1191 | 1174 | field->seqnum, |
---|
1192 | 1175 | field->duration, |
---|
1193 | 1176 | field->outer_duration, |
---|
1194 | 1177 | (long long)field->timestamp.tv_sec, |
---|
1195 | | - field->timestamp.tv_nsec); |
---|
| 1178 | + field->timestamp.tv_nsec, field->count); |
---|
1196 | 1179 | |
---|
1197 | 1180 | if (field->nmi_count) { |
---|
1198 | 1181 | /* |
---|