Commit 98759cca authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo
Browse files

perf intel-pt: Use guest pid/tid etc in guest samples



When decoding with guest sideband information, for VMX non-root (NR)
i.e. guest events, replace the host (hypervisor) pid/tid with guest values,
and provide also the new machine_pid and vcpu values.

Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: kvm@vger.kernel.org
Link: https://lore.kernel.org/r/20220711093218.10967-35-adrian.hunter@intel.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 61cd9135
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1657,6 +1657,17 @@ static void intel_pt_prep_a_sample(struct intel_pt_queue *ptq,

	sample->pid = ptq->pid;
	sample->tid = ptq->tid;

	if (ptq->pt->have_guest_sideband) {
		if ((ptq->state->from_ip && ptq->state->from_nr) ||
		    (ptq->state->to_ip && ptq->state->to_nr)) {
			sample->pid = ptq->guest_pid;
			sample->tid = ptq->guest_tid;
			sample->machine_pid = ptq->guest_machine_pid;
			sample->vcpu = ptq->vcpu;
		}
	}

	sample->cpu = ptq->cpu;
	sample->insn_len = ptq->insn_len;
	memcpy(sample->insn, ptq->insn, INTEL_PT_INSN_BUF_SZ);