[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SYBPR01MB68703FCDA8424EC486BB208E9D88A@SYBPR01MB6870.ausprd01.prod.outlook.com>
Date: Sun, 10 Dec 2023 16:16:14 +0800
From: Tianyi Liu <i.pear@...look.com>
To: seanjc@...gle.com, pbonzini@...hat.com, peterz@...radead.org,
mingo@...hat.com, acme@...nel.org
Cc: linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
kvm@...r.kernel.org, x86@...nel.org, mark.rutland@....com,
mlevitsk@...hat.com, maz@...nel.org,
alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
namhyung@...nel.org, irogers@...gle.com, adrian.hunter@...el.com,
Tianyi Liu <i.pear@...look.com>
Subject: [PATCH v3 5/5] perf tools: Support PERF_CONTEXT_GUEST_* flags
The `perf` util currently has an incomplete implementation for the
following event flags. Events with these flags will be dropped
or be identified as unknown types:
`PERF_CONTEXT_GUEST_KERNEL`
`PERF_CONTEXT_GUEST_USER`
This patch makes `perf script`, `perf timechart` and `perf data` to
correctly identify these flags.
Signed-off-by: Tianyi Liu <i.pear@...look.com>
---
tools/perf/builtin-timechart.c | 6 ++++++
tools/perf/util/data-convert-json.c | 6 ++++++
tools/perf/util/machine.c | 6 ++++++
3 files changed, 18 insertions(+)
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 19d4542ea18a..6a368b6a323e 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -536,6 +536,12 @@ static const char *cat_backtrace(union perf_event *event,
case PERF_CONTEXT_USER:
cpumode = PERF_RECORD_MISC_USER;
break;
+ case PERF_CONTEXT_GUEST_KERNEL:
+ cpumode = PERF_RECORD_MISC_GUEST_KERNEL;
+ break;
+ case PERF_CONTEXT_GUEST_USER:
+ cpumode = PERF_RECORD_MISC_GUEST_USER;
+ break;
default:
pr_debug("invalid callchain context: "
"%"PRId64"\n", (s64) ip);
diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
index 5bb3c2ba95ca..62686f78d973 100644
--- a/tools/perf/util/data-convert-json.c
+++ b/tools/perf/util/data-convert-json.c
@@ -205,6 +205,12 @@ static int process_sample_event(struct perf_tool *tool,
case PERF_CONTEXT_USER:
cpumode = PERF_RECORD_MISC_USER;
break;
+ case PERF_CONTEXT_GUEST_KERNEL:
+ cpumode = PERF_RECORD_MISC_GUEST_KERNEL;
+ break;
+ case PERF_CONTEXT_GUEST_USER:
+ cpumode = PERF_RECORD_MISC_GUEST_USER;
+ break;
default:
pr_debug("invalid callchain context: %"
PRId64 "\n", (s64) ip);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 90c750150b19..28eac11d0f61 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2343,6 +2343,12 @@ static int add_callchain_ip(struct thread *thread,
case PERF_CONTEXT_USER:
*cpumode = PERF_RECORD_MISC_USER;
break;
+ case PERF_CONTEXT_GUEST_KERNEL:
+ *cpumode = PERF_RECORD_MISC_GUEST_KERNEL;
+ break;
+ case PERF_CONTEXT_GUEST_USER:
+ *cpumode = PERF_RECORD_MISC_GUEST_USER;
+ break;
default:
pr_debug("invalid callchain context: "
"%"PRId64"\n", (s64) ip);
--
2.34.1
Powered by blists - more mailing lists