perf tools: Add missing initialization of perf_sample.cpumode in synthesized samples
In473398a21d
("perf tools: Add cpumode to struct perf_sample"), I missed some places where perf_sample fields are directly initialized in addition to what is done in perf_evsel__parse_sample(), namely when synthesizing PERF_RECORD_{MMAP*,COMM,FORK,EXIT} for pre-existing threads and also in intel_pt and intel_bts when synthesizing events from processor trace, the jitdump code also was affected, fix it. The problem was noticed with running: # perf record -e intel_pt//u true # perf script Where the samples wouldn't get resolved because perf_sample.cpumode would be left as zero, i.e. PERF_RECORD_MISC_CPUMODE_UNKNOWN, not resolving as kernel, hypervisor or user cpu modes. Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Fixes:473398a21d
("perf tools: Add cpumode to struct perf_sample") Link: http://lkml.kernel.org/n/tip-n5sdauxgk24d5nun8kuuu2mh@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -979,6 +979,7 @@ static int intel_pt_synth_branch_sample(struct intel_pt_queue *ptq)
|
||||
if (!pt->timeless_decoding)
|
||||
sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc);
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.ip = ptq->state->from_ip;
|
||||
sample.pid = ptq->pid;
|
||||
sample.tid = ptq->tid;
|
||||
@@ -1035,6 +1036,7 @@ static int intel_pt_synth_instruction_sample(struct intel_pt_queue *ptq)
|
||||
if (!pt->timeless_decoding)
|
||||
sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc);
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.ip = ptq->state->from_ip;
|
||||
sample.pid = ptq->pid;
|
||||
sample.tid = ptq->tid;
|
||||
@@ -1092,6 +1094,7 @@ static int intel_pt_synth_transaction_sample(struct intel_pt_queue *ptq)
|
||||
if (!pt->timeless_decoding)
|
||||
sample.time = tsc_to_perf_time(ptq->timestamp, &pt->tc);
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.ip = ptq->state->from_ip;
|
||||
sample.pid = ptq->pid;
|
||||
sample.tid = ptq->tid;
|
||||
|
Reference in New Issue
Block a user