perf kvm: Parse address location for samples
authorLeo Yan <leo.yan@linaro.org>
Wed, 15 Mar 2023 14:51:04 +0000 (22:51 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 15 Mar 2023 19:46:53 +0000 (16:46 -0300)
Parse address location for samples and save it into the structure
'perf_kvm_stat', it is to be used by histograms entry.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20230315145112.186603-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-kvm.c
tools/perf/util/kvm-stat.h

index ef502c19bc40ac33f59f97aaf8eaee73f89d34f6..17a8219a702a0e07fdb02b76a304186b6dc21ce5 100644 (file)
@@ -706,6 +706,11 @@ static int process_sample_event(struct perf_tool *tool,
        if (skip_sample(kvm, sample))
                return 0;
 
+       if (machine__resolve(machine, &kvm->al, sample) < 0) {
+               pr_warning("Fail to resolve address location, skip sample.\n");
+               return 0;
+       }
+
        thread = machine__findnew_thread(machine, sample->pid, sample->tid);
        if (thread == NULL) {
                pr_debug("problem processing %d event, skipping it.\n",
index e2c17662bac75326f2e65eb9e4cbacc457d5cfb5..3b2eab91a9bea742b57fcc4775567b3f8eb8ea85 100644 (file)
@@ -7,6 +7,7 @@
 #include "tool.h"
 #include "sort.h"
 #include "stat.h"
+#include "symbol.h"
 #include "record.h"
 
 #define KVM_EVENT_NAME_LEN     40
@@ -88,6 +89,9 @@ struct perf_kvm_stat {
        const char *sort_key;
        int trace_vcpu;
 
+       /* Used when process events */
+       struct addr_location al;
+
        struct exit_reasons_table *exit_reasons;
        const char *exit_reasons_isa;