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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5qnQnnkxGjYkTAM@google.com>
Date: Wed, 29 Jan 2025 14:10:10 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Adrian Hunter <adrian.hunter@...el.com>,
	Kan Liang <kan.liang@...ux.intel.com>,
	James Clark <james.clark@...aro.org>,
	Weilin Wang <weilin.wang@...el.com>,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] perf test: Skip Intel TPEBS under hypervisor

On Tue, Jan 28, 2025 at 09:59:38AM -0800, Ian Rogers wrote:
> On Tue, Jan 28, 2025 at 9:42 AM Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > On Mon, Jan 27, 2025 at 08:37:39PM -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>
> > > ---
> > > 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
> >
> > Shouldn't it simply be
> >
> >   if ! perf list hw | grep -q cache-misses
> 
> No, because that would succeed even if precise events weren't supported.

Oh I see.

> 
> > ?  Doesn't it work on hybrid?
> 
> Untested, but I don't see a difference between grepping an event from
> a file to using a match in a bash line. Neither specify a PMU so it is
> unclear to me why you'd think this would break.

No specific reason.  I thought checking `perf list` would be more
intuitive and then started to think there should be a reason.

Thanks,
Namhyung


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ