Skip to content

Commit

Permalink
ftrace: remove obsolete print continue functionality
Browse files Browse the repository at this point in the history
Impact: cleanup, remove obsolete code

Now that the ring buffer used by ftrace allows for variable length
entries, we do not need the 'cont' feature of the buffer.  This code
makes other parts of ftrace more complex and by removing this it
simplifies the ftrace code.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Dec 29, 2008
1 parent 0f01f07 commit c47956d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 74 deletions.
61 changes: 0 additions & 61 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1765,43 +1765,6 @@ static int task_state_char(unsigned long state)
return bit < sizeof(state_to_char) - 1 ? state_to_char[bit] : '?';
}

/*
* The message is supposed to contain an ending newline.
* If the printing stops prematurely, try to add a newline of our own.
*/
void trace_seq_print_cont(struct trace_seq *s, struct trace_iterator *iter)
{
struct trace_entry *ent;
struct trace_field_cont *cont;
bool ok = true;

ent = peek_next_entry(iter, iter->cpu, NULL);
if (!ent || ent->type != TRACE_CONT) {
trace_seq_putc(s, '\n');
return;
}

do {
cont = (struct trace_field_cont *)ent;
if (ok)
ok = (trace_seq_printf(s, "%s", cont->buf) > 0);

ftrace_disable_cpu();

if (iter->buffer_iter[iter->cpu])
ring_buffer_read(iter->buffer_iter[iter->cpu], NULL);
else
ring_buffer_consume(iter->tr->buffer, iter->cpu, NULL);

ftrace_enable_cpu();

ent = peek_next_entry(iter, iter->cpu, NULL);
} while (ent && ent->type == TRACE_CONT);

if (!ok)
trace_seq_putc(s, '\n');
}

static void test_cpu_buff_start(struct trace_iterator *iter)
{
struct trace_seq *s = &iter->seq;
Expand Down Expand Up @@ -1834,9 +1797,6 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
int S, T;
int i;

if (entry->type == TRACE_CONT)
return TRACE_TYPE_HANDLED;

test_cpu_buff_start(iter);

next_entry = find_next_entry(iter, NULL, &next_ts);
Expand Down Expand Up @@ -1922,8 +1882,6 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)

seq_print_ip_sym(s, field->ip, sym_flags);
trace_seq_printf(s, ": %s", field->buf);
if (entry->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);
break;
}
case TRACE_BRANCH: {
Expand Down Expand Up @@ -1968,9 +1926,6 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)

entry = iter->ent;

if (entry->type == TRACE_CONT)
return TRACE_TYPE_HANDLED;

test_cpu_buff_start(iter);

comm = trace_find_cmdline(iter->ent->pid);
Expand Down Expand Up @@ -2076,8 +2031,6 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)

seq_print_ip_sym(s, field->ip, sym_flags);
trace_seq_printf(s, ": %s", field->buf);
if (entry->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);
break;
}
case TRACE_GRAPH_RET: {
Expand Down Expand Up @@ -2124,9 +2077,6 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)

entry = iter->ent;

if (entry->type == TRACE_CONT)
return TRACE_TYPE_HANDLED;

ret = trace_seq_printf(s, "%d %d %llu ",
entry->pid, iter->cpu, iter->ts);
if (!ret)
Expand Down Expand Up @@ -2187,8 +2137,6 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
trace_assign_type(field, entry);

trace_seq_printf(s, "# %lx %s", field->ip, field->buf);
if (entry->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);
break;
}
}
Expand Down Expand Up @@ -2217,9 +2165,6 @@ static enum print_line_t print_hex_fmt(struct trace_iterator *iter)

entry = iter->ent;

if (entry->type == TRACE_CONT)
return TRACE_TYPE_HANDLED;

SEQ_PUT_HEX_FIELD_RET(s, entry->pid);
SEQ_PUT_HEX_FIELD_RET(s, iter->cpu);
SEQ_PUT_HEX_FIELD_RET(s, iter->ts);
Expand Down Expand Up @@ -2283,9 +2228,6 @@ static enum print_line_t print_printk_msg_only(struct trace_iterator *iter)
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

if (entry->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);

return TRACE_TYPE_HANDLED;
}

Expand All @@ -2296,9 +2238,6 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)

entry = iter->ent;

if (entry->type == TRACE_CONT)
return TRACE_TYPE_HANDLED;

SEQ_PUT_FIELD_RET(s, entry->pid);
SEQ_PUT_FIELD_RET(s, entry->cpu);
SEQ_PUT_FIELD_RET(s, iter->ts);
Expand Down
7 changes: 0 additions & 7 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ enum trace_type {
TRACE_FN,
TRACE_CTX,
TRACE_WAKE,
TRACE_CONT,
TRACE_STACK,
TRACE_PRINT,
TRACE_SPECIAL,
Expand Down Expand Up @@ -178,15 +177,13 @@ struct trace_power {
* NEED_RESCED - reschedule is requested
* HARDIRQ - inside an interrupt handler
* SOFTIRQ - inside a softirq handler
* CONT - multiple entries hold the trace item
*/
enum trace_flag_type {
TRACE_FLAG_IRQS_OFF = 0x01,
TRACE_FLAG_IRQS_NOSUPPORT = 0x02,
TRACE_FLAG_NEED_RESCHED = 0x04,
TRACE_FLAG_HARDIRQ = 0x08,
TRACE_FLAG_SOFTIRQ = 0x10,
TRACE_FLAG_CONT = 0x20,
};

#define TRACE_BUF_SIZE 1024
Expand Down Expand Up @@ -262,7 +259,6 @@ extern void __ftrace_bad_type(void);
do { \
IF_ASSIGN(var, ent, struct ftrace_entry, TRACE_FN); \
IF_ASSIGN(var, ent, struct ctx_switch_entry, 0); \
IF_ASSIGN(var, ent, struct trace_field_cont, TRACE_CONT); \
IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \
IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\
IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \
Expand Down Expand Up @@ -489,9 +485,6 @@ extern int trace_selftest_startup_branch(struct tracer *trace,

extern void *head_page(struct trace_array_cpu *data);
extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
extern void trace_seq_print_cont(struct trace_seq *s,
struct trace_iterator *iter);

extern int
seq_print_ip_sym(struct trace_seq *s, unsigned long ip,
unsigned long sym_flags);
Expand Down
3 changes: 0 additions & 3 deletions kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,6 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s,
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

if (ent->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);

/* Strip ending newline */
if (s->buffer[s->len - 1] == '\n') {
s->buffer[s->len - 1] = '\0';
Expand Down
3 changes: 0 additions & 3 deletions kernel/trace/trace_mmiotrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,6 @@ static enum print_line_t mmio_print_mark(struct trace_iterator *iter)
if (!ret)
return TRACE_TYPE_PARTIAL_LINE;

if (entry->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);

return TRACE_TYPE_HANDLED;
}

Expand Down

0 comments on commit c47956d

Please sign in to comment.