lkml.org 
[lkml]   [2022]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 33/35] perf intel-pt: Add machine_pid and vcpu to auxtrace_error
On Mon, Jul 11, 2022 at 2:34 AM Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> When decoding with guest sideband information, for VMX non-root (NR)
> i.e. guest errors, replace the host (hypervisor) pid/tid with guest values,
> and provide also the new machine_pid and vcpu values.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>

Acked-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
> tools/perf/util/intel-pt.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index a08c2f059d5a..143a096b567b 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -2404,7 +2404,8 @@ static int intel_pt_synth_iflag_chg_sample(struct intel_pt_queue *ptq)
> }
>
> static int intel_pt_synth_error(struct intel_pt *pt, int code, int cpu,
> - pid_t pid, pid_t tid, u64 ip, u64 timestamp)
> + pid_t pid, pid_t tid, u64 ip, u64 timestamp,
> + pid_t machine_pid, int vcpu)
> {
> union perf_event event;
> char msg[MAX_AUXTRACE_ERROR_MSG];
> @@ -2421,8 +2422,9 @@ static int intel_pt_synth_error(struct intel_pt *pt, int code, int cpu,
>
> intel_pt__strerror(code, msg, MAX_AUXTRACE_ERROR_MSG);
>
> - auxtrace_synth_error(&event.auxtrace_error, PERF_AUXTRACE_ERROR_ITRACE,
> - code, cpu, pid, tid, ip, msg, timestamp);
> + auxtrace_synth_guest_error(&event.auxtrace_error, PERF_AUXTRACE_ERROR_ITRACE,
> + code, cpu, pid, tid, ip, msg, timestamp,
> + machine_pid, vcpu);
>
> err = perf_session__deliver_synth_event(pt->session, &event, NULL);
> if (err)
> @@ -2437,11 +2439,22 @@ static int intel_ptq_synth_error(struct intel_pt_queue *ptq,
> {
> struct intel_pt *pt = ptq->pt;
> u64 tm = ptq->timestamp;
> + pid_t machine_pid = 0;
> + pid_t pid = ptq->pid;
> + pid_t tid = ptq->tid;
> + int vcpu = -1;
>
> tm = pt->timeless_decoding ? 0 : tsc_to_perf_time(tm, &pt->tc);
>
> - return intel_pt_synth_error(pt, state->err, ptq->cpu, ptq->pid,
> - ptq->tid, state->from_ip, tm);
> + if (pt->have_guest_sideband && state->from_nr) {
> + machine_pid = ptq->guest_machine_pid;
> + vcpu = ptq->vcpu;
> + pid = ptq->guest_pid;
> + tid = ptq->guest_tid;
> + }
> +
> + return intel_pt_synth_error(pt, state->err, ptq->cpu, pid, tid,
> + state->from_ip, tm, machine_pid, vcpu);
> }
>
> static int intel_pt_next_tid(struct intel_pt *pt, struct intel_pt_queue *ptq)
> @@ -3028,7 +3041,8 @@ static int intel_pt_process_timeless_sample(struct intel_pt *pt,
> static int intel_pt_lost(struct intel_pt *pt, struct perf_sample *sample)
> {
> return intel_pt_synth_error(pt, INTEL_PT_ERR_LOST, sample->cpu,
> - sample->pid, sample->tid, 0, sample->time);
> + sample->pid, sample->tid, 0, sample->time,
> + sample->machine_pid, sample->vcpu);
> }
>
> static struct intel_pt_queue *intel_pt_cpu_to_ptq(struct intel_pt *pt, int cpu)
> --
> 2.25.1
>

\
 
 \ /
  Last update: 2022-07-20 07:28    [W:0.341 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site