lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fXSupL7xLgpRmey=VpG1azcxQ9851-WRtFMO72ny+Ni-A@mail.gmail.com>
Date: Thu, 30 Jan 2025 08:41:10 -0800
From: Ian Rogers <irogers@...gle.com>
To: "Falcon, Thomas" <thomas.falcon@...el.com>
Cc: "james.clark@...aro.org" <james.clark@...aro.org>, 
	"alexander.shishkin@...ux.intel.com" <alexander.shishkin@...ux.intel.com>, 
	"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>, 
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, 
	"peterz@...radead.org" <peterz@...radead.org>, "acme@...nel.org" <acme@...nel.org>, 
	"mingo@...hat.com" <mingo@...hat.com>, "mark.rutland@....com" <mark.rutland@....com>, 
	"Hunter, Adrian" <adrian.hunter@...el.com>, "namhyung@...nel.org" <namhyung@...nel.org>, 
	"jolsa@...nel.org" <jolsa@...nel.org>, "kan.liang@...ux.intel.com" <kan.liang@...ux.intel.com>, 
	"Wang, Weilin" <weilin.wang@...el.com>
Subject: Re: [PATCH v2] perf test: Skip Intel TPEBS under hypervisor

On Wed, Jan 29, 2025 at 9:57 AM Falcon, Thomas <thomas.falcon@...el.com> wrote:
>
> 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@...gle.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?

Hi Tom,

sorry for this. I'll rebase/squash Google's patches [1] for this test
and resend as v2. I hadn't realized how much was missing when sending
this.

Thanks,
Ian

[1] https://github.com/googleprodkernel/linux-perf/commits/google_tools_master/tools/perf/tests/shell/test_stat_intel_tpebs.sh

> 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]"
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ