[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220111150749.13365-6-andrew.kilroy@arm.com>
Date: Tue, 11 Jan 2022 15:07:49 +0000
From: Andrew Kilroy <andrew.kilroy@....com>
To: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
acme@...nel.org, john.garry@...wei.com, irogers@...gle.com,
ak@...ux.intel.com
Cc: Andrew Kilroy <andrew.kilroy@....com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>
Subject: [RFC PATCH v2 5/5] perf stat: Ensure only topdown kernel events used on x86
Based on advice here:
https://lore.kernel.org/linux-perf-users/12e0deef-08db-445f-4958-bcd5c3e10367@linux.intel.com/#t
Only use the existing kernel events topdown mechanism on x86, not the
json metrics approach. Disabling the json metrics because of concerns
that due to SMT it's not straightforward to express the various formulas
as json for certain x86 cpus.
Signed-off-by: Andrew Kilroy <andrew.kilroy@....com>
---
tools/perf/builtin-stat.c | 22 +++++++++++++---------
tools/perf/util/topdown.c | 6 +++---
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 2f579d29f9f5..eee58fbf1986 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1814,16 +1814,20 @@ enum topdown_mechanism {
static enum topdown_mechanism choose_topdown_mechanism(void)
{
- int kernel_events_supported = topdown_kernel_events_supported();
-
- if (kernel_events_supported > 0) {
- pr_debug("topdown kernel events are supported\n");
- return TOPDOWN_KERNEL_EVENTS;
- } else if (kernel_events_supported == 0) {
- pr_debug("topdown kernel events are unsupported\n");
- return TOPDOWN_JSON_METRICS;
+ if (topdown_can_use_json_metrics()) {
+ int kernel_events_supported = topdown_kernel_events_supported();
+
+ if (kernel_events_supported > 0) {
+ pr_debug("topdown kernel events are supported\n");
+ return TOPDOWN_KERNEL_EVENTS;
+ } else if (kernel_events_supported == 0) {
+ pr_debug("topdown kernel events are unsupported\n");
+ return TOPDOWN_JSON_METRICS;
+ } else {
+ return TOPDOWN_DETECTION_ERROR;
+ }
} else {
- return TOPDOWN_DETECTION_ERROR;
+ return TOPDOWN_KERNEL_EVENTS;
}
}
diff --git a/tools/perf/util/topdown.c b/tools/perf/util/topdown.c
index a542dddd97f3..36f6c29009fb 100644
--- a/tools/perf/util/topdown.c
+++ b/tools/perf/util/topdown.c
@@ -59,10 +59,10 @@ __weak bool arch_topdown_sample_read(struct evsel *leader __maybe_unused)
bool topdown_can_use_json_metrics(void)
{
-#if defined(__aarch64__)
- return true;
-#else
+#if defined(__i386__) || defined(__x86_64__)
return false;
+#else
+ return true;
#endif
}
--
2.17.1
Powered by blists - more mailing lists