From: "Falcon, Thomas" <thomas.falcon@intel.com>
To: "james.clark@linaro.org" <james.clark@linaro.org>,
"alexander.shishkin@linux.intel.com"
<alexander.shishkin@linux.intel.com>,
"linux-perf-users@vger.kernel.org"
<linux-perf-users@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"acme@kernel.org" <acme@kernel.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"Hunter, Adrian" <adrian.hunter@intel.com>,
"namhyung@kernel.org" <namhyung@kernel.org>,
"jolsa@kernel.org" <jolsa@kernel.org>,
"kan.liang@linux.intel.com" <kan.liang@linux.intel.com>,
"irogers@google.com" <irogers@google.com>,
"Wang, Weilin" <weilin.wang@intel.com>
Subject: Re: [PATCH v2] perf test: Skip Intel TPEBS under hypervisor
Date: Wed, 29 Jan 2025 17:57:41 +0000 [thread overview]
Message-ID: <838b1fe1a3a303db5b050c787160a77a96e24ca5.camel@intel.com> (raw)
In-Reply-To: <20250128043739.256305-1-irogers@google.com>
On Mon, 2025-01-27 at 20:37 -0800, Ian Rogers wrote:
> Intel TPEBS test skips on non-Intel CPUs. On Intel CPUs under a
> hypervisor the cache-misses event may not be present. Skip the test
> under this condition.
>
> Refactor the output code to be placed in a file so that on a signal
> the file can be dumped. This was necessary to catch the issue above
> as
> the failing perf record command would fail without output.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
Hi, sorry, but I'm unable to apply this patch to perf-tools or perf-
tools-next? What repository should I use to test this?
Thanks,
Tom
> ---
> v2: Fix lost :R and use :p with record as it is ignored by perf stat.
> ---
> .../perf/tests/shell/test_stat_intel_tpebs.sh | 36 +++++++++++------
> --
> 1 file changed, 22 insertions(+), 14 deletions(-)
>
> diff --git a/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> b/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> index 695dcb93bb5e..a330ecdb7ba5 100755
> --- a/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> +++ b/tools/perf/tests/shell/test_stat_intel_tpebs.sh
> @@ -20,31 +20,39 @@ then
> exit 2
> fi
>
> +stat_output=$(mktemp /tmp/__perf_stat_tpebs_output.XXXXX)
> +
> cleanup() {
> + rm -rf "${stat_output}"
> trap - EXIT TERM INT
> }
>
> trap_cleanup() {
> echo "Unexpected signal in ${FUNCNAME[1]}"
> + cat "${stat_output}"
> cleanup
> exit 1
> }
> trap trap_cleanup EXIT TERM INT
>
> -# Use this event for testing because it should exist in all
> platforms
> -event=cache-misses:R
> -
> -# Hybrid platforms output like "cpu_atom/cache-misses/R", rather
> than as above
> -alt_name=/cache-misses/R
> +# Event to be used in tests
> +event=cache-misses
>
> -# Without this cmd option, default value or zero is returned
> -#echo "Testing without --record-tpebs"
> -#result=$(perf stat -e "$event" true 2>&1)
> -#[[ "$result" =~ $event || "$result" =~ $alt_name ]] || exit 1
> +if ! perf record -e "${event}:p" -a -o /dev/null sleep 0.01 >
> "${stat_output}" 2>&1
> +then
> + echo "Missing ${event} support"
> + cleanup
> + exit 2
> +fi
>
> test_with_record_tpebs() {
> echo "Testing with --record-tpebs"
> - result=$(perf stat -e "$event" --record-tpebs -a sleep 0.01 2>&1)
> + if ! perf stat -e "${event}:R" --record-tpebs -a sleep 0.01 >
> "${stat_output}" 2>&1
> + then
> + echo "Testing with --record-tpebs [Failed perf stat]"
> + cat "${stat_output}"
> + exit 1
> + fi
>
> # Expected output:
> # $ perf stat --record-tpebs -e cache-misses:R -a sleep 0.01
> @@ -57,16 +65,16 @@ test_with_record_tpebs() {
> # 0 cache-misses:R
> #
> # 0.013963299 seconds time elapsed
> - if [[ ! "$result" =~ "perf record" ]]
> + if ! grep "perf record" "${stat_output}"
> then
> echo "Testing with --record-tpebs [Failed missing perf record]"
> - echo "$result"
> + cat "${stat_output}"
> exit 1
> fi
> - if [[ ! "$result" =~ $event && ! "$result" =~ $alt_name ]]
> + if ! grep "${event}:R" "${stat_output}" && ! grep "/${event}/R"
> "${stat_output}"
> then
> echo "Testing with --record-tpebs [Failed missing event name]"
> - echo "$result"
> + cat "${stat_output}"
> exit 1
> fi
> echo "Testing with --record-tpebs [Success]"
next prev parent reply other threads:[~2025-01-29 17:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 4:37 [PATCH v2] perf test: Skip Intel TPEBS under hypervisor Ian Rogers
2025-01-28 17:42 ` Namhyung Kim
2025-01-28 17:59 ` Ian Rogers
2025-01-29 22:10 ` Namhyung Kim
2025-01-29 17:57 ` Falcon, Thomas [this message]
2025-01-30 16:41 ` Ian Rogers
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=838b1fe1a3a303db5b050c787160a77a96e24ca5.camel@intel.com \
--to=thomas.falcon@intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.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 \
--cc=weilin.wang@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