Commit 1830b52d authored by Steven Rostedt's avatar Steven Rostedt

trace: remove deprecated entry->cpu

Impact: fix to prevent developers from using entry->cpu

With the new ring buffer infrastructure, the cpu for the entry is
implicit with which CPU buffer it is on.

The original code use to record the current cpu into the generic
entry header, which can be retrieved by entry->cpu. When the
ring buffer was introduced, the users were convert to use the
the cpu number of which cpu ring buffer was in use (this was passed
to the tracers by the iterator: iter->cpu).

Unfortunately, the cpu item in the entry structure was never removed.
This allowed for developers to use it instead of the proper iter->cpu,
unknowingly, using an uninitialized variable. This was not the fault
of the developers, since it would seem like the logical place to
retrieve the cpu identifier.

This patch removes the cpu item from the entry structure and fixes
all the users that should have been using iter->cpu.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
parent 43769f10
...@@ -1531,7 +1531,7 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter) ...@@ -1531,7 +1531,7 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)
if (trace_flags & TRACE_ITER_CONTEXT_INFO) { if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
SEQ_PUT_FIELD_RET(s, entry->pid); SEQ_PUT_FIELD_RET(s, entry->pid);
SEQ_PUT_FIELD_RET(s, entry->cpu); SEQ_PUT_FIELD_RET(s, iter->cpu);
SEQ_PUT_FIELD_RET(s, iter->ts); SEQ_PUT_FIELD_RET(s, iter->ts);
} }
......
...@@ -45,7 +45,6 @@ enum trace_type { ...@@ -45,7 +45,6 @@ enum trace_type {
*/ */
struct trace_entry { struct trace_entry {
unsigned char type; unsigned char type;
unsigned char cpu;
unsigned char flags; unsigned char flags;
unsigned char preempt_count; unsigned char preempt_count;
int pid; int pid;
......
...@@ -159,7 +159,7 @@ static enum print_line_t bts_trace_print_line(struct trace_iterator *iter) ...@@ -159,7 +159,7 @@ static enum print_line_t bts_trace_print_line(struct trace_iterator *iter)
trace_assign_type(it, entry); trace_assign_type(it, entry);
if (entry->type == TRACE_HW_BRANCHES) { if (entry->type == TRACE_HW_BRANCHES) {
if (trace_seq_printf(seq, "%4d ", entry->cpu) && if (trace_seq_printf(seq, "%4d ", iter->cpu) &&
seq_print_ip_sym(seq, it->to, symflags) && seq_print_ip_sym(seq, it->to, symflags) &&
trace_seq_printf(seq, "\t <- ") && trace_seq_printf(seq, "\t <- ") &&
seq_print_ip_sym(seq, it->from, symflags) && seq_print_ip_sym(seq, it->from, symflags) &&
...@@ -195,7 +195,6 @@ void trace_hw_branch(u64 from, u64 to) ...@@ -195,7 +195,6 @@ void trace_hw_branch(u64 from, u64 to)
entry = ring_buffer_event_data(event); entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, from); tracing_generic_entry_update(&entry->ent, 0, from);
entry->ent.type = TRACE_HW_BRANCHES; entry->ent.type = TRACE_HW_BRANCHES;
entry->ent.cpu = cpu;
entry->from = from; entry->from = from;
entry->to = to; entry->to = to;
ring_buffer_unlock_commit(tr->buffer, event, irq2); ring_buffer_unlock_commit(tr->buffer, event, irq2);
......
...@@ -333,7 +333,7 @@ int trace_print_context(struct trace_iterator *iter) ...@@ -333,7 +333,7 @@ int trace_print_context(struct trace_iterator *iter)
unsigned long secs = (unsigned long)t; unsigned long secs = (unsigned long)t;
return trace_seq_printf(s, "%16s-%-5d [%03d] %5lu.%06lu: ", return trace_seq_printf(s, "%16s-%-5d [%03d] %5lu.%06lu: ",
comm, entry->pid, entry->cpu, secs, usec_rem); comm, entry->pid, iter->cpu, secs, usec_rem);
} }
int trace_print_lat_context(struct trace_iterator *iter) int trace_print_lat_context(struct trace_iterator *iter)
...@@ -356,7 +356,7 @@ int trace_print_lat_context(struct trace_iterator *iter) ...@@ -356,7 +356,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
char *comm = trace_find_cmdline(entry->pid); char *comm = trace_find_cmdline(entry->pid);
ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]"
" %ld.%03ldms (+%ld.%03ldms): ", comm, " %ld.%03ldms (+%ld.%03ldms): ", comm,
entry->pid, entry->cpu, entry->flags, entry->pid, iter->cpu, entry->flags,
entry->preempt_count, iter->idx, entry->preempt_count, iter->idx,
ns2usecs(iter->ts), ns2usecs(iter->ts),
abs_usecs / USEC_PER_MSEC, abs_usecs / USEC_PER_MSEC,
...@@ -364,7 +364,7 @@ int trace_print_lat_context(struct trace_iterator *iter) ...@@ -364,7 +364,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
rel_usecs / USEC_PER_MSEC, rel_usecs / USEC_PER_MSEC,
rel_usecs % USEC_PER_MSEC); rel_usecs % USEC_PER_MSEC);
} else { } else {
ret = lat_print_generic(s, entry, entry->cpu); ret = lat_print_generic(s, entry, iter->cpu);
if (ret) if (ret)
ret = lat_print_timestamp(s, abs_usecs, rel_usecs); ret = lat_print_timestamp(s, abs_usecs, rel_usecs);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment