linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: perry.taylor@intel.com, caleb.biggers@intel.com,
	kshipra.bopardikar@intel.com,
	Kan Liang <kan.liang@linux.intel.com>,
	Zhengjun Xing <zhengjun.xing@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Andi Kleen <ak@linux.intel.com>,
	James Clark <james.clark@arm.com>,
	John Garry <john.garry@huawei.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Sedat Dilek <sedat.dilek@gmail.com>
Cc: Stephane Eranian <eranian@google.com>, Ian Rogers <irogers@google.com>
Subject: [PATCH v1 01/31] perf test: Avoid sysfs state affecting fake events
Date: Fri, 22 Jul 2022 15:32:10 -0700	[thread overview]
Message-ID: <20220722223240.1618013-2-irogers@google.com> (raw)
In-Reply-To: <20220722223240.1618013-1-irogers@google.com>

Icelake has a slots event, on my Skylakex I have CPU events in sysfs
of topdown-slots-issued and topdown-total-slots. Legacy event parsing
would try to use '-' to separate parts of an event and so
perf_pmu__parse_init sets 'slots' to be a PMU_EVENT_SYMBOL_SUFFIX2. As
such parsing the slots event for a fake PMU fails as a
PMU_EVENT_SYMBOL_SUFFIX2 isn't made into the PE_PMU_EVENT_FAKE token.
Resolve this issue by test initializing the PMU parsing state before
every parse. This must be done every parse as the state is removes after
each parse_events.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/pmu-events.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c
index 478b33825790..263cbb67c861 100644
--- a/tools/perf/tests/pmu-events.c
+++ b/tools/perf/tests/pmu-events.c
@@ -812,6 +812,15 @@ static int check_parse_id(const char *id, struct parse_events_error *error,
 	for (cur = strchr(dup, '@') ; cur; cur = strchr(++cur, '@'))
 		*cur = '/';
 
+	if (fake_pmu) {
+		/*
+		 * Every call to __parse_events will try to initialize the PMU
+		 * state from sysfs and then clean it up at the end. Reset the
+		 * PMU events to the test state so that we don't pick up
+		 * erroneous prefixes and suffixes.
+		 */
+		perf_pmu__test_parse_init();
+	}
 	ret = __parse_events(evlist, dup, error, fake_pmu);
 	free(dup);
 
-- 
2.37.1.359.gd136c6c3e2-goog


  reply	other threads:[~2022-07-22 22:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 22:32 [PATCH v1 00/31] Add generated latest Intel events and metrics Ian Rogers
2022-07-22 22:32 ` Ian Rogers [this message]
2022-07-22 22:32 ` [PATCH v1 06/31] perf vendor events: Update bonnell mapfile.csv Ian Rogers
2022-07-22 22:32 ` [PATCH v1 09/31] perf vendor events: Update goldmont mapfile.csv Ian Rogers
2022-07-22 22:32 ` [PATCH v1 10/31] perf vendor events: Update goldmontplus mapfile.csv Ian Rogers
2022-07-22 22:32 ` [PATCH v1 11/31] perf vendor events: Update Intel haswell Ian Rogers
2022-07-22 22:32 ` [PATCH v1 13/31] perf vendor events: Update Intel icelake Ian Rogers
2022-07-22 22:32 ` [PATCH v1 14/31] perf vendor events: Update Intel icelakex Ian Rogers
2022-07-22 22:32 ` [PATCH v1 15/31] perf vendor events: Update Intel ivybridge Ian Rogers
2022-07-22 22:32 ` [PATCH v1 19/31] perf vendor events: Add Intel meteorlake Ian Rogers
2022-07-22 22:32 ` [PATCH v1 20/31] perf vendor events: Update Intel nehalemep Ian Rogers
2022-07-22 22:32 ` [PATCH v1 22/31] perf vendor events: Update Intel sandybridge Ian Rogers
2022-07-22 22:32 ` [PATCH v1 24/31] perf vendor events: Update Intel silvermont Ian Rogers
2022-07-22 22:32 ` [PATCH v1 25/31] perf vendor events: Update Intel skylake Ian Rogers
2022-07-22 22:32 ` [PATCH v1 28/31] perf vendor events: Update Intel tigerlake Ian Rogers
2022-07-22 22:32 ` [PATCH v1 29/31] perf vendor events: Update Intel westmereep-dp Ian Rogers
2022-07-22 22:32 ` [PATCH v1 30/31] perf vendor events: Update Intel westmereep-sp Ian Rogers
2022-07-22 22:32 ` [PATCH v1 31/31] perf vendor events: Update Intel westmereex Ian Rogers
2022-07-24  5:51 ` [PATCH v1 00/31] Add generated latest Intel events and metrics Sedat Dilek
2022-07-24 19:08   ` Ian Rogers
2022-07-27  6:48     ` Sedat Dilek
2022-07-27 22:30       ` Ian Rogers
     [not found] ` <20220722223240.1618013-3-irogers@google.com>
     [not found]   ` <2c29ab7e-5fc5-5458-926c-11430e7c3c3b@linux.intel.com>
     [not found]     ` <CAP-5=fV65fiadnaAmebYS1CjxwuFy4oKxV88v6oHdVPCc=n+Ow@mail.gmail.com>
2022-07-26  1:25       ` [PATCH v1 02/31] perf vendor events: Update Intel broadwellx Xing Zhengjun
2022-07-26  4:49         ` Ian Rogers
2022-07-26  5:19           ` Xing Zhengjun

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=20220722223240.1618013-2-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=caleb.biggers@intel.com \
    --cc=eranian@google.com \
    --cc=james.clark@arm.com \
    --cc=john.garry@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=kshipra.bopardikar@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=perry.taylor@intel.com \
    --cc=peterz@infradead.org \
    --cc=sedat.dilek@gmail.com \
    --cc=zhengjun.xing@linux.intel.com \
    /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).