.. | .. |
---|
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); |
---|
.. | .. |
---|
504 | 497 | |
---|
505 | 498 | trace_find_cmdline(entry->pid, comm); |
---|
506 | 499 | |
---|
507 | | - trace_seq_printf(s, "%8.8s-%-5d %3d", |
---|
| 500 | + trace_seq_printf(s, "%8.8s-%-7d %3d", |
---|
508 | 501 | comm, entry->pid, cpu); |
---|
509 | 502 | |
---|
510 | 503 | return trace_print_lat_fmt(s, entry); |
---|
.. | .. |
---|
545 | 538 | struct trace_array *tr = iter->tr; |
---|
546 | 539 | unsigned long verbose = tr->trace_flags & TRACE_ITER_VERBOSE; |
---|
547 | 540 | unsigned long in_ns = iter->iter_flags & TRACE_FILE_TIME_IN_NS; |
---|
548 | | - 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; |
---|
549 | 542 | unsigned long long rel_ts = next_ts - iter->ts; |
---|
550 | 543 | struct trace_seq *s = &iter->seq; |
---|
551 | 544 | |
---|
.. | .. |
---|
595 | 588 | |
---|
596 | 589 | trace_find_cmdline(entry->pid, comm); |
---|
597 | 590 | |
---|
598 | | - trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); |
---|
| 591 | + trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid); |
---|
599 | 592 | |
---|
600 | 593 | if (tr->trace_flags & TRACE_ITER_RECORD_TGID) { |
---|
601 | 594 | unsigned int tgid = trace_find_tgid(entry->pid); |
---|
602 | 595 | |
---|
603 | 596 | if (!tgid) |
---|
604 | | - trace_seq_printf(s, "(-----) "); |
---|
| 597 | + trace_seq_printf(s, "(-------) "); |
---|
605 | 598 | else |
---|
606 | | - trace_seq_printf(s, "(%5d) ", tgid); |
---|
| 599 | + trace_seq_printf(s, "(%7d) ", tgid); |
---|
607 | 600 | } |
---|
608 | 601 | |
---|
609 | 602 | trace_seq_printf(s, "[%03d] ", iter->cpu); |
---|
.. | .. |
---|
624 | 617 | |
---|
625 | 618 | int trace_print_lat_context(struct trace_iterator *iter) |
---|
626 | 619 | { |
---|
| 620 | + struct trace_entry *entry, *next_entry; |
---|
627 | 621 | struct trace_array *tr = iter->tr; |
---|
628 | | - /* trace_find_next_entry will reset ent_size */ |
---|
629 | | - int ent_size = iter->ent_size; |
---|
630 | 622 | struct trace_seq *s = &iter->seq; |
---|
631 | | - u64 next_ts; |
---|
632 | | - struct trace_entry *entry = iter->ent, |
---|
633 | | - *next_entry = trace_find_next_entry(iter, NULL, |
---|
634 | | - &next_ts); |
---|
635 | 623 | unsigned long verbose = (tr->trace_flags & TRACE_ITER_VERBOSE); |
---|
| 624 | + u64 next_ts; |
---|
636 | 625 | |
---|
637 | | - /* Restore the original ent_size */ |
---|
638 | | - iter->ent_size = ent_size; |
---|
639 | | - |
---|
| 626 | + next_entry = trace_find_next_entry(iter, NULL, &next_ts); |
---|
640 | 627 | if (!next_entry) |
---|
641 | 628 | next_ts = iter->ts; |
---|
| 629 | + |
---|
| 630 | + /* trace_find_next_entry() may change iter->ent */ |
---|
| 631 | + entry = iter->ent; |
---|
642 | 632 | |
---|
643 | 633 | if (verbose) { |
---|
644 | 634 | char comm[TASK_COMM_LEN]; |
---|
.. | .. |
---|
646 | 636 | trace_find_cmdline(entry->pid, comm); |
---|
647 | 637 | |
---|
648 | 638 | trace_seq_printf( |
---|
649 | | - s, "%16s %5d %3d %d %08x %08lx ", |
---|
| 639 | + s, "%16s %7d %3d %d %08x %08lx ", |
---|
650 | 640 | comm, entry->pid, iter->cpu, entry->flags, |
---|
651 | 641 | entry->preempt_count, iter->idx); |
---|
652 | 642 | } else { |
---|
.. | .. |
---|
685 | 675 | static int trace_search_list(struct list_head **list) |
---|
686 | 676 | { |
---|
687 | 677 | struct trace_event *e; |
---|
688 | | - int last = __TRACE_LAST_TYPE; |
---|
| 678 | + int next = __TRACE_LAST_TYPE; |
---|
689 | 679 | |
---|
690 | 680 | if (list_empty(&ftrace_event_list)) { |
---|
691 | 681 | *list = &ftrace_event_list; |
---|
692 | | - return last + 1; |
---|
| 682 | + return next; |
---|
693 | 683 | } |
---|
694 | 684 | |
---|
695 | 685 | /* |
---|
.. | .. |
---|
697 | 687 | * lets see if somebody freed one. |
---|
698 | 688 | */ |
---|
699 | 689 | list_for_each_entry(e, &ftrace_event_list, list) { |
---|
700 | | - if (e->type != last + 1) |
---|
| 690 | + if (e->type != next) |
---|
701 | 691 | break; |
---|
702 | | - last++; |
---|
| 692 | + next++; |
---|
703 | 693 | } |
---|
704 | 694 | |
---|
705 | 695 | /* Did we used up all 65 thousand events??? */ |
---|
706 | | - if ((last + 1) > TRACE_EVENT_TYPE_MAX) |
---|
| 696 | + if (next > TRACE_EVENT_TYPE_MAX) |
---|
707 | 697 | return 0; |
---|
708 | 698 | |
---|
709 | 699 | *list = &e->list; |
---|
710 | | - return last + 1; |
---|
| 700 | + return next; |
---|
711 | 701 | } |
---|
712 | 702 | |
---|
713 | 703 | void trace_event_read_lock(void) |
---|
.. | .. |
---|
927 | 917 | S = task_index_to_char(field->prev_state); |
---|
928 | 918 | trace_find_cmdline(field->next_pid, comm); |
---|
929 | 919 | trace_seq_printf(&iter->seq, |
---|
930 | | - " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n", |
---|
| 920 | + " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n", |
---|
931 | 921 | field->prev_pid, |
---|
932 | 922 | field->prev_prio, |
---|
933 | 923 | S, delim, |
---|
.. | .. |
---|
1079 | 1069 | |
---|
1080 | 1070 | trace_seq_puts(s, "<stack trace>\n"); |
---|
1081 | 1071 | |
---|
1082 | | - for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { |
---|
| 1072 | + for (p = field->caller; p && p < end && *p != ULONG_MAX; p++) { |
---|
1083 | 1073 | |
---|
1084 | 1074 | if (trace_seq_has_overflowed(s)) |
---|
1085 | 1075 | break; |
---|
.. | .. |
---|
1131 | 1121 | for (i = 0; i < FTRACE_STACK_ENTRIES; i++) { |
---|
1132 | 1122 | unsigned long ip = field->caller[i]; |
---|
1133 | 1123 | |
---|
1134 | | - if (ip == ULONG_MAX || trace_seq_has_overflowed(s)) |
---|
| 1124 | + if (!ip || trace_seq_has_overflowed(s)) |
---|
1135 | 1125 | break; |
---|
1136 | 1126 | |
---|
1137 | 1127 | trace_seq_puts(s, " => "); |
---|
1138 | | - |
---|
1139 | | - if (!ip) { |
---|
1140 | | - trace_seq_puts(s, "??"); |
---|
1141 | | - trace_seq_putc(s, '\n'); |
---|
1142 | | - continue; |
---|
1143 | | - } |
---|
1144 | | - |
---|
1145 | 1128 | seq_print_user_ip(s, mm, ip, flags); |
---|
1146 | 1129 | trace_seq_putc(s, '\n'); |
---|
1147 | 1130 | } |
---|
.. | .. |
---|
1172 | 1155 | |
---|
1173 | 1156 | trace_assign_type(field, entry); |
---|
1174 | 1157 | |
---|
1175 | | - 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", |
---|
1176 | 1159 | field->seqnum, |
---|
1177 | 1160 | field->duration, |
---|
1178 | 1161 | field->outer_duration, |
---|
1179 | 1162 | (long long)field->timestamp.tv_sec, |
---|
1180 | | - field->timestamp.tv_nsec); |
---|
| 1163 | + field->timestamp.tv_nsec, field->count); |
---|
1181 | 1164 | |
---|
1182 | 1165 | if (field->nmi_count) { |
---|
1183 | 1166 | /* |
---|
.. | .. |
---|
1395 | 1378 | NULL |
---|
1396 | 1379 | }; |
---|
1397 | 1380 | |
---|
1398 | | -__init static int init_events(void) |
---|
| 1381 | +__init int init_events(void) |
---|
1399 | 1382 | { |
---|
1400 | 1383 | struct trace_event *event; |
---|
1401 | 1384 | int i, ret; |
---|
.. | .. |
---|
1413 | 1396 | |
---|
1414 | 1397 | return 0; |
---|
1415 | 1398 | } |
---|
1416 | | -early_initcall(init_events); |
---|