Loading kernel/trace/trace.c +44 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ enum trace_type { TRACE_FN, TRACE_CTX, TRACE_SPECIAL, __TRACE_LAST_TYPE }; Loading Loading @@ -700,6 +701,22 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data, spin_unlock(&data->lock); } notrace void trace_special(struct trace_array *tr, struct trace_array_cpu *data, unsigned long arg1, unsigned long arg2, unsigned long arg3) { struct trace_entry *entry; spin_lock(&data->lock); entry = tracing_get_trace_entry(tr, data); tracing_generic_entry_update(entry, 0); entry->type = TRACE_SPECIAL; entry->special.arg1 = arg1; entry->special.arg2 = arg2; entry->special.arg3 = arg3; spin_unlock(&data->lock); } notrace void tracing_sched_switch_trace(struct trace_array *tr, struct trace_array_cpu *data, Loading Loading @@ -1167,6 +1184,12 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) entry->ctx.next_prio, comm); break; case TRACE_SPECIAL: trace_seq_printf(s, " %lx %lx %lx\n", entry->special.arg1, entry->special.arg2, entry->special.arg3); break; default: trace_seq_printf(s, "Unknown type %d\n", entry->type); } Loading Loading @@ -1234,6 +1257,14 @@ static notrace int print_trace_fmt(struct trace_iterator *iter) if (!ret) return 0; break; case TRACE_SPECIAL: ret = trace_seq_printf(s, " %lx %lx %lx\n", entry->special.arg1, entry->special.arg2, entry->special.arg3); if (!ret) return 0; break; } return 1; } Loading Loading @@ -1271,6 +1302,14 @@ static notrace int print_raw_fmt(struct trace_iterator *iter) if (!ret) return 0; break; case TRACE_SPECIAL: ret = trace_seq_printf(s, " %lx %lx %lx\n", entry->special.arg1, entry->special.arg2, entry->special.arg3); if (!ret) return 0; break; } return 1; } Loading Loading @@ -1304,6 +1343,11 @@ static notrace int print_bin_fmt(struct trace_iterator *iter) SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid); SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio); break; case TRACE_SPECIAL: SEQ_PUT_FIELD_RET(s, entry->special.arg1); SEQ_PUT_FIELD_RET(s, entry->special.arg2); SEQ_PUT_FIELD_RET(s, entry->special.arg3); break; } return 1; } Loading kernel/trace/trace.h +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,15 @@ struct ctx_switch_entry { unsigned char next_prio; }; /* * Special (free-form) trace entry: */ struct special_entry { unsigned long arg1; unsigned long arg2; unsigned long arg3; }; /* * The trace entry - the most basic unit of tracing. This is what * is printed in the end as a single line in the trace output, such as: Loading @@ -41,6 +50,7 @@ struct trace_entry { union { struct ftrace_entry fn; struct ctx_switch_entry ctx; struct special_entry special; }; }; Loading Loading @@ -154,6 +164,11 @@ void tracing_sched_switch_trace(struct trace_array *tr, struct task_struct *next, unsigned long flags); void tracing_record_cmdline(struct task_struct *tsk); void trace_special(struct trace_array *tr, struct trace_array_cpu *data, unsigned long arg1, unsigned long arg2, unsigned long arg3); void tracing_start_function_trace(void); void tracing_stop_function_trace(void); Loading Loading
kernel/trace/trace.c +44 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ enum trace_type { TRACE_FN, TRACE_CTX, TRACE_SPECIAL, __TRACE_LAST_TYPE }; Loading Loading @@ -700,6 +701,22 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data, spin_unlock(&data->lock); } notrace void trace_special(struct trace_array *tr, struct trace_array_cpu *data, unsigned long arg1, unsigned long arg2, unsigned long arg3) { struct trace_entry *entry; spin_lock(&data->lock); entry = tracing_get_trace_entry(tr, data); tracing_generic_entry_update(entry, 0); entry->type = TRACE_SPECIAL; entry->special.arg1 = arg1; entry->special.arg2 = arg2; entry->special.arg3 = arg3; spin_unlock(&data->lock); } notrace void tracing_sched_switch_trace(struct trace_array *tr, struct trace_array_cpu *data, Loading Loading @@ -1167,6 +1184,12 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) entry->ctx.next_prio, comm); break; case TRACE_SPECIAL: trace_seq_printf(s, " %lx %lx %lx\n", entry->special.arg1, entry->special.arg2, entry->special.arg3); break; default: trace_seq_printf(s, "Unknown type %d\n", entry->type); } Loading Loading @@ -1234,6 +1257,14 @@ static notrace int print_trace_fmt(struct trace_iterator *iter) if (!ret) return 0; break; case TRACE_SPECIAL: ret = trace_seq_printf(s, " %lx %lx %lx\n", entry->special.arg1, entry->special.arg2, entry->special.arg3); if (!ret) return 0; break; } return 1; } Loading Loading @@ -1271,6 +1302,14 @@ static notrace int print_raw_fmt(struct trace_iterator *iter) if (!ret) return 0; break; case TRACE_SPECIAL: ret = trace_seq_printf(s, " %lx %lx %lx\n", entry->special.arg1, entry->special.arg2, entry->special.arg3); if (!ret) return 0; break; } return 1; } Loading Loading @@ -1304,6 +1343,11 @@ static notrace int print_bin_fmt(struct trace_iterator *iter) SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid); SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio); break; case TRACE_SPECIAL: SEQ_PUT_FIELD_RET(s, entry->special.arg1); SEQ_PUT_FIELD_RET(s, entry->special.arg2); SEQ_PUT_FIELD_RET(s, entry->special.arg3); break; } return 1; } Loading
kernel/trace/trace.h +15 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,15 @@ struct ctx_switch_entry { unsigned char next_prio; }; /* * Special (free-form) trace entry: */ struct special_entry { unsigned long arg1; unsigned long arg2; unsigned long arg3; }; /* * The trace entry - the most basic unit of tracing. This is what * is printed in the end as a single line in the trace output, such as: Loading @@ -41,6 +50,7 @@ struct trace_entry { union { struct ftrace_entry fn; struct ctx_switch_entry ctx; struct special_entry special; }; }; Loading Loading @@ -154,6 +164,11 @@ void tracing_sched_switch_trace(struct trace_array *tr, struct task_struct *next, unsigned long flags); void tracing_record_cmdline(struct task_struct *tsk); void trace_special(struct trace_array *tr, struct trace_array_cpu *data, unsigned long arg1, unsigned long arg2, unsigned long arg3); void tracing_start_function_trace(void); void tracing_stop_function_trace(void); Loading