4 * Copyright (C) 2008 Red Hat Inc, Steven Rostedt <srostedt@redhat.com>
8 #include <linux/module.h>
9 #include <linux/mutex.h>
10 #include <linux/ftrace.h>
12 #include "trace_output.h"
14 /* must be a power of 2 */
15 #define EVENT_HASHSIZE 128
17 static DEFINE_MUTEX(trace_event_mutex);
18 static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
20 static int next_event_type = __TRACE_LAST_TYPE + 1;
22 void trace_print_seq(struct seq_file *m, struct trace_seq *s)
24 int len = s->len >= PAGE_SIZE ? PAGE_SIZE - 1 : s->len;
27 seq_puts(m, s->buffer);
32 enum print_line_t trace_print_bprintk_msg_only(struct trace_iterator *iter)
34 struct trace_seq *s = &iter->seq;
35 struct trace_entry *entry = iter->ent;
36 struct bprint_entry *field;
39 trace_assign_type(field, entry);
41 ret = trace_seq_bprintf(s, field->fmt, field->buf);
43 return TRACE_TYPE_PARTIAL_LINE;
45 return TRACE_TYPE_HANDLED;
48 enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
50 struct trace_seq *s = &iter->seq;
51 struct trace_entry *entry = iter->ent;
52 struct print_entry *field;
55 trace_assign_type(field, entry);
57 ret = trace_seq_printf(s, "%s", field->buf);
59 return TRACE_TYPE_PARTIAL_LINE;
61 return TRACE_TYPE_HANDLED;
65 * trace_seq_printf - sequence printing of trace information
66 * @s: trace sequence descriptor
67 * @fmt: printf format string
69 * The tracer may use either sequence operations or its own
70 * copy to user routines. To simplify formating of a trace
71 * trace_seq_printf is used to store strings into a special
72 * buffer (@s). Then the output may be either used by
73 * the sequencer or pulled into another buffer.
76 trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
78 int len = (PAGE_SIZE - 1) - s->len;
86 ret = vsnprintf(s->buffer + s->len, len, fmt, ap);
89 /* If we can't write it all, don't bother writing anything */
97 EXPORT_SYMBOL_GPL(trace_seq_printf);
99 int trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
101 int len = (PAGE_SIZE - 1) - s->len;
107 ret = bstr_printf(s->buffer + s->len, len, fmt, binary);
109 /* If we can't write it all, don't bother writing anything */
119 * trace_seq_puts - trace sequence printing of simple string
120 * @s: trace sequence descriptor
121 * @str: simple string to record
123 * The tracer may use either the sequence operations or its own
124 * copy to user routines. This function records a simple string
125 * into a special buffer (@s) for later retrieval by a sequencer
126 * or other mechanism.
128 int trace_seq_puts(struct trace_seq *s, const char *str)
130 int len = strlen(str);
132 if (len > ((PAGE_SIZE - 1) - s->len))
135 memcpy(s->buffer + s->len, str, len);
141 int trace_seq_putc(struct trace_seq *s, unsigned char c)
143 if (s->len >= (PAGE_SIZE - 1))
146 s->buffer[s->len++] = c;
151 int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len)
153 if (len > ((PAGE_SIZE - 1) - s->len))
156 memcpy(s->buffer + s->len, mem, len);
162 int trace_seq_putmem_hex(struct trace_seq *s, const void *mem, size_t len)
164 unsigned char hex[HEX_CHARS];
165 const unsigned char *data = mem;
169 for (i = 0, j = 0; i < len; i++) {
171 for (i = len-1, j = 0; i >= 0; i--) {
173 hex[j++] = hex_asc_hi(data[i]);
174 hex[j++] = hex_asc_lo(data[i]);
178 return trace_seq_putmem(s, hex, j);
181 void *trace_seq_reserve(struct trace_seq *s, size_t len)
185 if (len > ((PAGE_SIZE - 1) - s->len))
188 ret = s->buffer + s->len;
194 int trace_seq_path(struct trace_seq *s, struct path *path)
198 if (s->len >= (PAGE_SIZE - 1))
200 p = d_path(path, s->buffer + s->len, PAGE_SIZE - s->len);
202 p = mangle_path(s->buffer + s->len, p, "\n");
204 s->len = p - s->buffer;
208 s->buffer[s->len++] = '?';
215 #ifdef CONFIG_KRETPROBES
216 static inline const char *kretprobed(const char *name)
218 static const char tramp_name[] = "kretprobe_trampoline";
219 int size = sizeof(tramp_name);
221 if (strncmp(tramp_name, name, size) == 0)
222 return "[unknown/kretprobe'd]";
226 static inline const char *kretprobed(const char *name)
230 #endif /* CONFIG_KRETPROBES */
233 seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address)
235 #ifdef CONFIG_KALLSYMS
236 char str[KSYM_SYMBOL_LEN];
239 kallsyms_lookup(address, NULL, NULL, NULL, str);
241 name = kretprobed(str);
243 return trace_seq_printf(s, fmt, name);
249 seq_print_sym_offset(struct trace_seq *s, const char *fmt,
250 unsigned long address)
252 #ifdef CONFIG_KALLSYMS
253 char str[KSYM_SYMBOL_LEN];
256 sprint_symbol(str, address);
257 name = kretprobed(str);
259 return trace_seq_printf(s, fmt, name);
265 # define IP_FMT "%08lx"
267 # define IP_FMT "%016lx"
270 int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm,
271 unsigned long ip, unsigned long sym_flags)
273 struct file *file = NULL;
274 unsigned long vmstart = 0;
278 const struct vm_area_struct *vma;
280 down_read(&mm->mmap_sem);
281 vma = find_vma(mm, ip);
284 vmstart = vma->vm_start;
287 ret = trace_seq_path(s, &file->f_path);
289 ret = trace_seq_printf(s, "[+0x%lx]",
292 up_read(&mm->mmap_sem);
294 if (ret && ((sym_flags & TRACE_ITER_SYM_ADDR) || !file))
295 ret = trace_seq_printf(s, " <" IP_FMT ">", ip);
300 seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s,
301 unsigned long sym_flags)
303 struct mm_struct *mm = NULL;
307 if (trace_flags & TRACE_ITER_SYM_USEROBJ) {
308 struct task_struct *task;
310 * we do the lookup on the thread group leader,
311 * since individual threads might have already quit!
314 task = find_task_by_vpid(entry->ent.tgid);
316 mm = get_task_mm(task);
320 for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
321 unsigned long ip = entry->caller[i];
323 if (ip == ULONG_MAX || !ret)
326 ret = trace_seq_puts(s, " <- ");
329 ret = trace_seq_puts(s, "??");
335 ret = seq_print_user_ip(s, mm, ip, sym_flags);
344 seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
349 return trace_seq_printf(s, "0");
351 if (sym_flags & TRACE_ITER_SYM_OFFSET)
352 ret = seq_print_sym_offset(s, "%s", ip);
354 ret = seq_print_sym_short(s, "%s", ip);
359 if (sym_flags & TRACE_ITER_SYM_ADDR)
360 ret = trace_seq_printf(s, " <" IP_FMT ">", ip);
365 lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
367 int hardirq, softirq;
368 char comm[TASK_COMM_LEN];
370 trace_find_cmdline(entry->pid, comm);
371 hardirq = entry->flags & TRACE_FLAG_HARDIRQ;
372 softirq = entry->flags & TRACE_FLAG_SOFTIRQ;
374 if (!trace_seq_printf(s, "%8.8s-%-5d %3d%c%c%c",
375 comm, entry->pid, cpu,
376 (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' :
377 (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ?
379 (entry->flags & TRACE_FLAG_NEED_RESCHED) ?
381 (hardirq && softirq) ? 'H' :
382 hardirq ? 'h' : softirq ? 's' : '.'))
385 if (entry->preempt_count)
386 return trace_seq_printf(s, "%x", entry->preempt_count);
387 return trace_seq_puts(s, ".");
390 static unsigned long preempt_mark_thresh = 100;
393 lat_print_timestamp(struct trace_seq *s, u64 abs_usecs,
394 unsigned long rel_usecs)
396 return trace_seq_printf(s, " %4lldus%c: ", abs_usecs,
397 rel_usecs > preempt_mark_thresh ? '!' :
398 rel_usecs > 1 ? '+' : ' ');
401 int trace_print_context(struct trace_iterator *iter)
403 struct trace_seq *s = &iter->seq;
404 struct trace_entry *entry = iter->ent;
405 unsigned long long t = ns2usecs(iter->ts);
406 unsigned long usec_rem = do_div(t, USEC_PER_SEC);
407 unsigned long secs = (unsigned long)t;
408 char comm[TASK_COMM_LEN];
410 trace_find_cmdline(entry->pid, comm);
412 return trace_seq_printf(s, "%16s-%-5d [%03d] %5lu.%06lu: ",
413 comm, entry->pid, iter->cpu, secs, usec_rem);
416 int trace_print_lat_context(struct trace_iterator *iter)
420 struct trace_seq *s = &iter->seq;
421 struct trace_entry *entry = iter->ent,
422 *next_entry = trace_find_next_entry(iter, NULL,
424 unsigned long verbose = (trace_flags & TRACE_ITER_VERBOSE);
425 unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start);
426 unsigned long rel_usecs;
430 rel_usecs = ns2usecs(next_ts - iter->ts);
433 char comm[TASK_COMM_LEN];
435 trace_find_cmdline(entry->pid, comm);
437 ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08llx]"
438 " %ld.%03ldms (+%ld.%03ldms): ", comm,
439 entry->pid, iter->cpu, entry->flags,
440 entry->preempt_count, iter->idx,
442 abs_usecs / USEC_PER_MSEC,
443 abs_usecs % USEC_PER_MSEC,
444 rel_usecs / USEC_PER_MSEC,
445 rel_usecs % USEC_PER_MSEC);
447 ret = lat_print_generic(s, entry, iter->cpu);
449 ret = lat_print_timestamp(s, abs_usecs, rel_usecs);
455 static const char state_to_char[] = TASK_STATE_TO_CHAR_STR;
457 static int task_state_char(unsigned long state)
459 int bit = state ? __ffs(state) + 1 : 0;
461 return bit < sizeof(state_to_char) - 1 ? state_to_char[bit] : '?';
465 * ftrace_find_event - find a registered event
466 * @type: the type of event to look for
468 * Returns an event of type @type otherwise NULL
470 struct trace_event *ftrace_find_event(int type)
472 struct trace_event *event;
473 struct hlist_node *n;
476 key = type & (EVENT_HASHSIZE - 1);
478 hlist_for_each_entry_rcu(event, n, &event_hash[key], node) {
479 if (event->type == type)
486 static LIST_HEAD(ftrace_event_list);
488 static int trace_search_list(struct list_head **list)
490 struct trace_event *e;
491 int last = __TRACE_LAST_TYPE;
493 if (list_empty(&ftrace_event_list)) {
494 *list = &ftrace_event_list;
499 * We used up all possible max events,
500 * lets see if somebody freed one.
502 list_for_each_entry(e, &ftrace_event_list, list) {
503 if (e->type != last + 1)
508 /* Did we used up all 65 thousand events??? */
509 if ((last + 1) > FTRACE_MAX_EVENT)
517 * register_ftrace_event - register output for an event type
518 * @event: the event type to register
520 * Event types are stored in a hash and this hash is used to
521 * find a way to print an event. If the @event->type is set
522 * then it will use that type, otherwise it will assign a
525 * If you assign your own type, please make sure it is added
526 * to the trace_type enum in trace.h, to avoid collisions
527 * with the dynamic types.
529 * Returns the event type number or zero on error.
531 int register_ftrace_event(struct trace_event *event)
536 mutex_lock(&trace_event_mutex);
541 INIT_LIST_HEAD(&event->list);
544 struct list_head *list;
546 if (next_event_type > FTRACE_MAX_EVENT) {
548 event->type = trace_search_list(&list);
554 event->type = next_event_type++;
555 list = &ftrace_event_list;
558 if (WARN_ON(ftrace_find_event(event->type)))
561 list_add_tail(&event->list, list);
563 } else if (event->type > __TRACE_LAST_TYPE) {
564 printk(KERN_WARNING "Need to add type to trace.h\n");
568 /* Is this event already used */
569 if (ftrace_find_event(event->type))
573 if (event->trace == NULL)
574 event->trace = trace_nop_print;
575 if (event->raw == NULL)
576 event->raw = trace_nop_print;
577 if (event->hex == NULL)
578 event->hex = trace_nop_print;
579 if (event->binary == NULL)
580 event->binary = trace_nop_print;
582 key = event->type & (EVENT_HASHSIZE - 1);
584 hlist_add_head_rcu(&event->node, &event_hash[key]);
588 mutex_unlock(&trace_event_mutex);
592 EXPORT_SYMBOL_GPL(register_ftrace_event);
595 * unregister_ftrace_event - remove a no longer used event
596 * @event: the event to remove
598 int unregister_ftrace_event(struct trace_event *event)
600 mutex_lock(&trace_event_mutex);
601 hlist_del(&event->node);
602 list_del(&event->list);
603 mutex_unlock(&trace_event_mutex);
607 EXPORT_SYMBOL_GPL(unregister_ftrace_event);
613 enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags)
615 return TRACE_TYPE_HANDLED;
619 static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags)
621 struct ftrace_entry *field;
622 struct trace_seq *s = &iter->seq;
624 trace_assign_type(field, iter->ent);
626 if (!seq_print_ip_sym(s, field->ip, flags))
629 if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) {
630 if (!trace_seq_printf(s, " <-"))
632 if (!seq_print_ip_sym(s,
637 if (!trace_seq_printf(s, "\n"))
640 return TRACE_TYPE_HANDLED;
643 return TRACE_TYPE_PARTIAL_LINE;
646 static enum print_line_t trace_fn_raw(struct trace_iterator *iter, int flags)
648 struct ftrace_entry *field;
650 trace_assign_type(field, iter->ent);
652 if (!trace_seq_printf(&iter->seq, "%lx %lx\n",
655 return TRACE_TYPE_PARTIAL_LINE;
657 return TRACE_TYPE_HANDLED;
660 static enum print_line_t trace_fn_hex(struct trace_iterator *iter, int flags)
662 struct ftrace_entry *field;
663 struct trace_seq *s = &iter->seq;
665 trace_assign_type(field, iter->ent);
667 SEQ_PUT_HEX_FIELD_RET(s, field->ip);
668 SEQ_PUT_HEX_FIELD_RET(s, field->parent_ip);
670 return TRACE_TYPE_HANDLED;
673 static enum print_line_t trace_fn_bin(struct trace_iterator *iter, int flags)
675 struct ftrace_entry *field;
676 struct trace_seq *s = &iter->seq;
678 trace_assign_type(field, iter->ent);
680 SEQ_PUT_FIELD_RET(s, field->ip);
681 SEQ_PUT_FIELD_RET(s, field->parent_ip);
683 return TRACE_TYPE_HANDLED;
686 static struct trace_event trace_fn_event = {
688 .trace = trace_fn_trace,
691 .binary = trace_fn_bin,
694 /* TRACE_CTX an TRACE_WAKE */
695 static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
698 struct ctx_switch_entry *field;
699 char comm[TASK_COMM_LEN];
703 trace_assign_type(field, iter->ent);
705 T = task_state_char(field->next_state);
706 S = task_state_char(field->prev_state);
707 trace_find_cmdline(field->next_pid, comm);
708 if (!trace_seq_printf(&iter->seq,
709 " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
717 return TRACE_TYPE_PARTIAL_LINE;
719 return TRACE_TYPE_HANDLED;
722 static enum print_line_t trace_ctx_print(struct trace_iterator *iter, int flags)
724 return trace_ctxwake_print(iter, "==>");
727 static enum print_line_t trace_wake_print(struct trace_iterator *iter,
730 return trace_ctxwake_print(iter, " +");
733 static int trace_ctxwake_raw(struct trace_iterator *iter, char S)
735 struct ctx_switch_entry *field;
738 trace_assign_type(field, iter->ent);
741 task_state_char(field->prev_state);
742 T = task_state_char(field->next_state);
743 if (!trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n",
751 return TRACE_TYPE_PARTIAL_LINE;
753 return TRACE_TYPE_HANDLED;
756 static enum print_line_t trace_ctx_raw(struct trace_iterator *iter, int flags)
758 return trace_ctxwake_raw(iter, 0);
761 static enum print_line_t trace_wake_raw(struct trace_iterator *iter, int flags)
763 return trace_ctxwake_raw(iter, '+');
767 static int trace_ctxwake_hex(struct trace_iterator *iter, char S)
769 struct ctx_switch_entry *field;
770 struct trace_seq *s = &iter->seq;
773 trace_assign_type(field, iter->ent);
776 task_state_char(field->prev_state);
777 T = task_state_char(field->next_state);
779 SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid);
780 SEQ_PUT_HEX_FIELD_RET(s, field->prev_prio);
781 SEQ_PUT_HEX_FIELD_RET(s, S);
782 SEQ_PUT_HEX_FIELD_RET(s, field->next_cpu);
783 SEQ_PUT_HEX_FIELD_RET(s, field->next_pid);
784 SEQ_PUT_HEX_FIELD_RET(s, field->next_prio);
785 SEQ_PUT_HEX_FIELD_RET(s, T);
787 return TRACE_TYPE_HANDLED;
790 static enum print_line_t trace_ctx_hex(struct trace_iterator *iter, int flags)
792 return trace_ctxwake_hex(iter, 0);
795 static enum print_line_t trace_wake_hex(struct trace_iterator *iter, int flags)
797 return trace_ctxwake_hex(iter, '+');
800 static enum print_line_t trace_ctxwake_bin(struct trace_iterator *iter,
803 struct ctx_switch_entry *field;
804 struct trace_seq *s = &iter->seq;
806 trace_assign_type(field, iter->ent);
808 SEQ_PUT_FIELD_RET(s, field->prev_pid);
809 SEQ_PUT_FIELD_RET(s, field->prev_prio);
810 SEQ_PUT_FIELD_RET(s, field->prev_state);
811 SEQ_PUT_FIELD_RET(s, field->next_pid);
812 SEQ_PUT_FIELD_RET(s, field->next_prio);
813 SEQ_PUT_FIELD_RET(s, field->next_state);
815 return TRACE_TYPE_HANDLED;
818 static struct trace_event trace_ctx_event = {
820 .trace = trace_ctx_print,
821 .raw = trace_ctx_raw,
822 .hex = trace_ctx_hex,
823 .binary = trace_ctxwake_bin,
826 static struct trace_event trace_wake_event = {
828 .trace = trace_wake_print,
829 .raw = trace_wake_raw,
830 .hex = trace_wake_hex,
831 .binary = trace_ctxwake_bin,
835 static enum print_line_t trace_special_print(struct trace_iterator *iter,
838 struct special_entry *field;
840 trace_assign_type(field, iter->ent);
842 if (!trace_seq_printf(&iter->seq, "# %ld %ld %ld\n",
846 return TRACE_TYPE_PARTIAL_LINE;
848 return TRACE_TYPE_HANDLED;
851 static enum print_line_t trace_special_hex(struct trace_iterator *iter,
854 struct special_entry *field;
855 struct trace_seq *s = &iter->seq;
857 trace_assign_type(field, iter->ent);
859 SEQ_PUT_HEX_FIELD_RET(s, field->arg1);
860 SEQ_PUT_HEX_FIELD_RET(s, field->arg2);
861 SEQ_PUT_HEX_FIELD_RET(s, field->arg3);
863 return TRACE_TYPE_HANDLED;
866 static enum print_line_t trace_special_bin(struct trace_iterator *iter,
869 struct special_entry *field;
870 struct trace_seq *s = &iter->seq;
872 trace_assign_type(field, iter->ent);
874 SEQ_PUT_FIELD_RET(s, field->arg1);
875 SEQ_PUT_FIELD_RET(s, field->arg2);
876 SEQ_PUT_FIELD_RET(s, field->arg3);
878 return TRACE_TYPE_HANDLED;
881 static struct trace_event trace_special_event = {
882 .type = TRACE_SPECIAL,
883 .trace = trace_special_print,
884 .raw = trace_special_print,
885 .hex = trace_special_hex,
886 .binary = trace_special_bin,
891 static enum print_line_t trace_stack_print(struct trace_iterator *iter,
894 struct stack_entry *field;
895 struct trace_seq *s = &iter->seq;
898 trace_assign_type(field, iter->ent);
900 for (i = 0; i < FTRACE_STACK_ENTRIES; i++) {
902 if (!trace_seq_puts(s, " <= "))
905 if (!seq_print_ip_sym(s, field->caller[i], flags))
908 if (!trace_seq_puts(s, "\n"))
912 return TRACE_TYPE_HANDLED;
915 return TRACE_TYPE_PARTIAL_LINE;
918 static struct trace_event trace_stack_event = {
920 .trace = trace_stack_print,
921 .raw = trace_special_print,
922 .hex = trace_special_hex,
923 .binary = trace_special_bin,
926 /* TRACE_USER_STACK */
927 static enum print_line_t trace_user_stack_print(struct trace_iterator *iter,
930 struct userstack_entry *field;
931 struct trace_seq *s = &iter->seq;
933 trace_assign_type(field, iter->ent);
935 if (!seq_print_userip_objs(field, s, flags))
938 if (!trace_seq_putc(s, '\n'))
941 return TRACE_TYPE_HANDLED;
944 return TRACE_TYPE_PARTIAL_LINE;
947 static struct trace_event trace_user_stack_event = {
948 .type = TRACE_USER_STACK,
949 .trace = trace_user_stack_print,
950 .raw = trace_special_print,
951 .hex = trace_special_hex,
952 .binary = trace_special_bin,
956 static enum print_line_t
957 trace_bprint_print(struct trace_iterator *iter, int flags)
959 struct trace_entry *entry = iter->ent;
960 struct trace_seq *s = &iter->seq;
961 struct bprint_entry *field;
963 trace_assign_type(field, entry);
965 if (!seq_print_ip_sym(s, field->ip, flags))
968 if (!trace_seq_puts(s, ": "))
971 if (!trace_seq_bprintf(s, field->fmt, field->buf))
974 return TRACE_TYPE_HANDLED;
977 return TRACE_TYPE_PARTIAL_LINE;
981 static enum print_line_t
982 trace_bprint_raw(struct trace_iterator *iter, int flags)
984 struct bprint_entry *field;
985 struct trace_seq *s = &iter->seq;
987 trace_assign_type(field, iter->ent);
989 if (!trace_seq_printf(s, ": %lx : ", field->ip))
992 if (!trace_seq_bprintf(s, field->fmt, field->buf))
995 return TRACE_TYPE_HANDLED;
998 return TRACE_TYPE_PARTIAL_LINE;
1002 static struct trace_event trace_bprint_event = {
1003 .type = TRACE_BPRINT,
1004 .trace = trace_bprint_print,
1005 .raw = trace_bprint_raw,
1009 static enum print_line_t trace_print_print(struct trace_iterator *iter,
1012 struct print_entry *field;
1013 struct trace_seq *s = &iter->seq;
1015 trace_assign_type(field, iter->ent);
1017 if (!seq_print_ip_sym(s, field->ip, flags))
1020 if (!trace_seq_printf(s, ": %s", field->buf))
1023 return TRACE_TYPE_HANDLED;
1026 return TRACE_TYPE_PARTIAL_LINE;
1029 static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags)
1031 struct print_entry *field;
1033 trace_assign_type(field, iter->ent);
1035 if (!trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf))
1038 return TRACE_TYPE_HANDLED;
1041 return TRACE_TYPE_PARTIAL_LINE;
1044 static struct trace_event trace_print_event = {
1045 .type = TRACE_PRINT,
1046 .trace = trace_print_print,
1047 .raw = trace_print_raw,
1051 static struct trace_event *events[] __initdata = {
1055 &trace_special_event,
1057 &trace_user_stack_event,
1058 &trace_bprint_event,
1063 __init static int init_events(void)
1065 struct trace_event *event;
1068 for (i = 0; events[i]; i++) {
1071 ret = register_ftrace_event(event);
1073 printk(KERN_WARNING "event %d failed to register\n",
1081 device_initcall(init_events);