From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
James Clark <james.clark@arm.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Kajol Jain <kjain@linux.ibm.com>
Subject: [PATCH v1] perf test pmu: Warn don't fail for legacy mixed case event names
Date: Wed, 12 Jun 2024 05:40:27 -0700 [thread overview]
Message-ID: <20240612124027.2712643-1-irogers@google.com> (raw)
PowerPC has mixed case events matching legacy hardware cache
events. Warn but don't fail in this case. Event parsing will still
work in this case by matching the legacy case.
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Kajol Jain <kjain@linux.ibm.com>
---
tools/perf/tests/pmu.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/tools/perf/tests/pmu.c b/tools/perf/tests/pmu.c
index cc88b5920c3e..201df4446f7c 100644
--- a/tools/perf/tests/pmu.c
+++ b/tools/perf/tests/pmu.c
@@ -260,26 +260,42 @@ static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest
static bool permitted_event_name(const char *name)
{
bool has_lower = false, has_upper = false;
+ __u64 config;
for (size_t i = 0; i < strlen(name); i++) {
char c = name[i];
if (islower(c)) {
if (has_upper)
- return false;
+ goto check_legacy;
has_lower = true;
continue;
}
if (isupper(c)) {
if (has_lower)
- return false;
+ goto check_legacy;
has_upper = true;
continue;
}
if (!isdigit(c) && c != '.' && c != '_' && c != '-')
- return false;
+ goto check_legacy;
}
return true;
+check_legacy:
+ /*
+ * If the event name matches a legacy cache name the legacy encoding
+ * will still be used. This isn't quite WAI as sysfs events should take
+ * priority, but this case happens on PowerPC and matches the behavior
+ * in older perf tools where legacy events were the priority. Be
+ * permissive and assume later PMU drivers will use all lower or upper
+ * case names.
+ */
+ if (parse_events__decode_legacy_cache(name, /*extended_pmu_type=*/0, &config) == 0) {
+ pr_warning("sysfs event '%s' should be all lower/upper case, it will be matched using legacy encoding.",
+ name);
+ return true;
+ }
+ return false;
}
static int test__pmu_event_names(struct test_suite *test __maybe_unused,
--
2.45.2.505.gda0bf45e8d-goog
next reply other threads:[~2024-06-12 12:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 12:40 Ian Rogers [this message]
2024-06-14 13:45 ` [PATCH v1] perf test pmu: Warn don't fail for legacy mixed case event names Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240612124027.2712643-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).