perf thread-stack: Fix thread stack processing for the idle task
perf creates a single 'struct thread' to represent the idle task. That is because threads are identified by PID and TID, and the idle task always has PID == TID == 0. However, there are actually separate idle tasks for each CPU. That creates a problem for thread stack processing which assumes that each thread has a single stack, not one stack per CPU. Fix that by passing through the CPU number, and in the case of the idle "thread", pick the thread stack from an array based on the CPU number. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: http://lkml.kernel.org/r/20181221120620.9659-8-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
139f42f3b3
commit
256d92bc93
@@ -1174,7 +1174,7 @@ static void intel_pt_prep_sample(struct intel_pt *pt,
|
||||
intel_pt_prep_b_sample(pt, ptq, event, sample);
|
||||
|
||||
if (pt->synth_opts.callchain) {
|
||||
thread_stack__sample(ptq->thread, ptq->chain,
|
||||
thread_stack__sample(ptq->thread, ptq->cpu, ptq->chain,
|
||||
pt->synth_opts.callchain_sz + 1,
|
||||
sample->ip, pt->kernel_start);
|
||||
sample->callchain = ptq->chain;
|
||||
@@ -1526,11 +1526,11 @@ static int intel_pt_sample(struct intel_pt_queue *ptq)
|
||||
return 0;
|
||||
|
||||
if (pt->synth_opts.callchain || pt->synth_opts.thread_stack)
|
||||
thread_stack__event(ptq->thread, ptq->flags, state->from_ip,
|
||||
thread_stack__event(ptq->thread, ptq->cpu, ptq->flags, state->from_ip,
|
||||
state->to_ip, ptq->insn_len,
|
||||
state->trace_nr);
|
||||
else
|
||||
thread_stack__set_trace_nr(ptq->thread, state->trace_nr);
|
||||
thread_stack__set_trace_nr(ptq->thread, ptq->cpu, state->trace_nr);
|
||||
|
||||
if (pt->sample_branches) {
|
||||
err = intel_pt_synth_branch_sample(ptq);
|
||||
|
Reference in New Issue
Block a user