tracing/core: drop the cpu field from trace_entry
PATCH 4/5 tracing/core: drop the cpu field from trace_entry
Impact: fix a bug on cpu output
While looking on the function tracer traces, I first cheered up:
TASK-PID CPU# TIMESTAMP FUNCTION
| | | | |
firefox-4622 [081] 1315.790405: lapic_next_event <-clockevents_program_event
firefox-4622 [178] 1315.790405: native_apic_mem_write <-lapic_next_event
firefox-4622 [020] 1315.790406: perf_counter_unthrottle <-smp_apic_timer_interruptBut no, actually I don't have so many cpus...
This is a small bug: the cpu field on trace entry is never set up. Lots of tracers use it on their context info to display the cpu number. But the cpu number on which a trace occured is already known elsewhere: the ring-buffer is per cpu and we know
which cpu was used to store an event on the ring buffer, this information is on the struct trace_iterator.
So both are overlaping. The cpu field on trace_entry is useless.
Unfortunatly we are not gaining any bytes, because the cpu is an unsigned char, the structure will be padded to stay well memory aligned.
After this patch:
<idle>-0 [001] 67.452518: __rcu_read_unlock <-input_pass_event
<idle>-0 [000] 67.452518: ktime_get <-tick_nohz_stop_idle
<idle>-0 [000] 67.452518: ktime_get_ts <-ktime_get
<idle>-0 [001] 67.452518: _spin_unlock_irqrestore <-input_eventSadly I've retrieved my two cpus....
--- kernel/trace/trace.c | 2 +- kernel/trace/trace.h | 1 - kernel/trace/trace_output.c | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-)
kernel/trace/trace.c +1 -1
@@ -1519,7 +1519,7 @@ static enum print_line_t print_bin_fmt(struct trace_iterator *iter)if (trace_flags &TRACE_ITER_CONTEXT_INFO ) {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); }
kernel/trace/trace.h +0 -1
@@ -46,7 +46,6 @@ enum trace_type {*/ struct trace_entry {unsigned char type; -unsigned char cpu;unsigned char flags;unsigned char preempt_count;int pid;
kernel/trace/trace_output.c +3 -3
@@ -333,7 +333,7 @@ int trace_print_context(struct trace_iterator *iter)unsigned long secs = (unsigned long )t;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)
@@ -356,7 +356,7 @@ int trace_print_lat_context(struct trace_iterator *iter)char *comm =trace_find_cmdline (entry->pid); ret = trace_seq_printf(s, "%16s %5d %3d %d %08x %08lx [%08lx]" " %ld.%03ldms (+%ld.%03ldms): ", comm, - entry->pid, entry->cpu, entry->flags, + entry->pid, iter->cpu, entry->flags, entry->preempt_count, iter->idx, ns2usecs(iter->ts), abs_usecs / USEC_PER_MSEC,
@@ -364,7 +364,7 @@ int trace_print_lat_context(struct trace_iterator *iter) rel_usecs /USEC_PER_MSEC , rel_usecs % USEC_PER_MSEC); }else { - ret =lat_print_generic (s, entry, entry->cpu); + ret =lat_print_generic (s, entry, iter->cpu);if (ret) ret =lat_print_timestamp (s, abs_usecs, rel_usecs); }
Signature · 1 line
1.6.1
Quoted 11 lines · Frederic Weisbecker
Impact: fix a bug on cpu output
While looking on the function tracer traces, I first cheered up:
TASK-PID CPU# TIMESTAMP FUNCTION | | | | | firefox-4622 [081] 1315.790405: lapic_next_event <-clockevents_program_event firefox-4622 [178] 1315.790405: native_apic_mem_write <-lapic_next_event firefox-4622 [020] 1315.790406: perf_counter_unthrottle <-smp_apic_timer_interruptBut no, actually I don't have so many cpus...
incidentally, Steve came up with the exact same patch :)
Ingo
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Frederic Weisbecker
Impact: fix a bug on cpu output
While looking on the function tracer traces, I first cheered up:
TASK-PID CPU# TIMESTAMP FUNCTION | | | | | firefox-4622 [081] 1315.790405: lapic_next_event <-clockevents_program_event firefox-4622 [178] 1315.790405: native_apic_mem_write <-lapic_next_event firefox-4622 [020] 1315.790406: perf_counter_unthrottle <-smp_apic_timer_interrupt
Quoted 5 lines
Quoted 1 line
But no, actually I don't have so many cpus...
incidentally, Steve came up with the exact same patch :)
Ingo
Heh, I guess the moon inspired both of us in the name of tracing, or something like that...
Anyway, thanks for having applied the other patches :-)
Quoted 14 lines · Frederic Weisbecker
Quoted 13 lines · Ingo Molnar
Quoted 10 lines · Frederic Weisbecker
Impact: fix a bug on cpu output
While looking on the function tracer traces, I first cheered up:
TASK-PID CPU# TIMESTAMP FUNCTION | | | | | firefox-4622 [081] 1315.790405: lapic_next_event <-clockevents_program_event firefox-4622 [178] 1315.790405: native_apic_mem_write <-lapic_next_event firefox-4622 [020] 1315.790406: perf_counter_unthrottle <-smp_apic_timer_interrupt
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
But no, actually I don't have so many cpus...
incidentally, Steve came up with the exact same patch :)
Ingo
Heh, I guess the moon inspired both of us in the name of tracing, or something like that...
It was exactly at around the time Thomas complained over IRC about the visible CPU# breakage in the tracer output.
So i blame it on telepathy ;-)
Ingo
Steven Rostedt
maintainerQuoted 23 lines · Ingo Molnar
Quoted 20 lines · Frederic Weisbecker
Quoted 18 lines · Ingo Molnar
Quoted 11 lines · Frederic Weisbecker
Impact: fix a bug on cpu output
While looking on the function tracer traces, I first cheered up:
TASK-PID CPU# TIMESTAMP FUNCTION | | | | | firefox-4622 [081] 1315.790405: lapic_next_event <-clockevents_program_event firefox-4622 [178] 1315.790405: native_apic_mem_write <-lapic_next_event firefox-4622 [020] 1315.790406: perf_counter_unthrottle <-smp_apic_timer_interruptBut no, actually I don't have so many cpus...
incidentally, Steve came up with the exact same patch :)
Ingo
Quoted 7 lines
Quoted 2 lines
Heh, I guess the moon inspired both of us in the name of tracing, or something like that...
It was exactly at around the time Thomas complained over IRC about the visible CPU# breakage in the tracer output.
So i blame it on telepathy ;-)
Thomas was the full moon, his complaint to me was the reason I pushed it out ASAP.
-- Steve