aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-02-07 19:38:43 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-02-07 19:38:43 -0500
commit1830b52d0de8c60c4f5dfbac134aa8f69d815801 (patch)
tree2aa803853ac145fedd0d65324d77f64d25e7b3a2 /kernel
parent43769f10b4826376cbf4ce17af74a5b4e8dc4fcd (diff)
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: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c2
-rw-r--r--kernel/trace/trace.h1
-rw-r--r--kernel/trace/trace_hw_branches.c3
-rw-r--r--kernel/trace/trace_output.c6
4 files changed, 5 insertions, 7 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index fd51cf0b94c7..bd4d9f8818fa 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1531,7 +1531,7 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)
1531 1531
1532 if (trace_flags & TRACE_ITER_CONTEXT_INFO) { 1532 if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
1533 SEQ_PUT_FIELD_RET(s, entry->pid); 1533 SEQ_PUT_FIELD_RET(s, entry->pid);
1534 SEQ_PUT_FIELD_RET(s, entry->cpu); 1534 SEQ_PUT_FIELD_RET(s, iter->cpu);
1535 SEQ_PUT_FIELD_RET(s, iter->ts); 1535 SEQ_PUT_FIELD_RET(s, iter->ts);
1536 } 1536 }
1537 1537
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index f0c7a0f08cac..5efc4c707f7e 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -45,7 +45,6 @@ enum trace_type {
45 */ 45 */
46struct trace_entry { 46struct trace_entry {
47 unsigned char type; 47 unsigned char type;
48 unsigned char cpu;
49 unsigned char flags; 48 unsigned char flags;
50 unsigned char preempt_count; 49 unsigned char preempt_count;
51 int pid; 50 int pid;
diff --git a/kernel/trace/trace_hw_branches.c b/kernel/trace/trace_hw_branches.c
index fff3545fc866..549238a9b133 100644
--- a/kernel/trace/trace_hw_branches.c
+++ b/kernel/trace/trace_hw_branches.c
@@ -159,7 +159,7 @@ static enum print_line_t bts_trace_print_line(struct trace_iterator *iter)
159 trace_assign_type(it, entry); 159 trace_assign_type(it, entry);
160 160
161 if (entry->type == TRACE_HW_BRANCHES) { 161 if (entry->type == TRACE_HW_BRANCHES) {
162 if (trace_seq_printf(seq, "%4d ", entry->cpu) && 162 if (trace_seq_printf(seq, "%4d ", iter->cpu) &&
163 seq_print_ip_sym(seq, it->to, symflags) && 163 seq_print_ip_sym(seq, it->to, symflags) &&
164 trace_seq_printf(seq, "\t <- ") && 164 trace_seq_printf(seq, "\t <- ") &&
165 seq_print_ip_sym(seq, it->from, symflags) && 165 seq_print_ip_sym(seq, it->from, symflags) &&
@@ -195,7 +195,6 @@ void trace_hw_branch(u64 from, u64 to)
195 entry = ring_buffer_event_data(event); 195 entry = ring_buffer_event_data(event);
196 tracing_generic_entry_update(&entry->ent, 0, from); 196 tracing_generic_entry_update(&entry->ent, 0, from);
197 entry->ent.type = TRACE_HW_BRANCHES; 197 entry->ent.type = TRACE_HW_BRANCHES;
198 entry->ent.cpu = cpu;
199 entry->from = from; 198 entry->from = from;
200 entry->to = to; 199 entry->to = to;
201 ring_buffer_unlock_commit(tr->buffer, event, irq2); 200 ring_buffer_unlock_commit(tr->buffer, event, irq2);
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index b7380eee9fa1..463a310b1d3b 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -333,7 +333,7 @@ int trace_print_context(struct trace_iterator *iter)
333 unsigned long secs = (unsigned long)t; 333 unsigned long secs = (unsigned long)t;
334 334
335 return trace_seq_printf(s, "%16s-%-5d [%03d] %5lu.%06lu: ", 335 return trace_seq_printf(s, "%16s-%-5d [%03d] %5lu.%06lu: ",
336 comm, entry->pid, entry->cpu, secs, usec_rem); 336 comm, entry->pid, iter->cpu, secs, usec_rem);
337} 337}
338 338
339int trace_print_lat_context(struct trace_iterator *iter) 339int trace_print_lat_context(struct trace_iterator *iter)
@@ -356,7 +356,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
356 char *comm = trace_find_cmdline(entry->pid); 356 char *comm = trace_find_cmdline(entry->pid);
357 ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" 357 ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]"
358 " %ld.%03ldms (+%ld.%03ldms): ", comm, 358 " %ld.%03ldms (+%ld.%03ldms): ", comm,
359 entry->pid, entry->cpu, entry->flags, 359 entry->pid, iter->cpu, entry->flags,
360 entry->preempt_count, iter->idx, 360 entry->preempt_count, iter->idx,
361 ns2usecs(iter->ts), 361 ns2usecs(iter->ts),
362 abs_usecs / USEC_PER_MSEC, 362 abs_usecs / USEC_PER_MSEC,
@@ -364,7 +364,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
364 rel_usecs / USEC_PER_MSEC, 364 rel_usecs / USEC_PER_MSEC,
365 rel_usecs % USEC_PER_MSEC); 365 rel_usecs % USEC_PER_MSEC);
366 } else { 366 } else {
367 ret = lat_print_generic(s, entry, entry->cpu); 367 ret = lat_print_generic(s, entry, iter->cpu);
368 if (ret) 368 if (ret)
369 ret = lat_print_timestamp(s, abs_usecs, rel_usecs); 369 ret = lat_print_timestamp(s, abs_usecs, rel_usecs);
370 } 370 }