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: <f3f143f2-408c-4632-991a-ff0de53349d8@linaro.org>
Date: Mon, 16 Sep 2024 14:25:45 +0100
From: James Clark <james.clark@...aro.org>
To: Leo Yan <leo.yan@....com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
 Arnaldo Carvalho de Melo <acme@...nel.org>,
 Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
 Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
 Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
 Adrian Hunter <adrian.hunter@...el.com>,
 "Liang, Kan" <kan.liang@...ux.intel.com>,
 Suzuki K Poulose <suzuki.poulose@....com>, Mike Leach
 <mike.leach@...aro.org>, John Garry <john.g.garry@...cle.com>,
 Will Deacon <will@...nel.org>, Leo Yan <leo.yan@...ux.dev>,
 Ben Gainey <ben.gainey@....com>, Ruidong Tian
 <tianruidong@...ux.alibaba.com>, Benjamin Gray <bgray@...ux.ibm.com>,
 Mathieu Poirier <mathieu.poirier@...aro.org>, linux-kernel@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-perf-users@...r.kernel.org,
 gankulkarni@...amperecomputing.com, coresight@...ts.linaro.org,
 scclevenger@...amperecomputing.com
Subject: Re: [PATCH v2 7/7] perf test: cs-etm: Test Coresight disassembly
 script



On 13/09/2024 14:35, Leo Yan wrote:
> 
> 
> On 9/12/24 16:11, James Clark wrote:
>>
>> Run a few samples through the disassembly script and check to see that
>> at least one branch instruction is printed.
>>
>> Signed-off-by: James Clark <james.clark@...aro.org>
>> ---
>>   .../tests/shell/test_arm_coresight_disasm.sh  | 63 +++++++++++++++++++
>>   1 file changed, 63 insertions(+)
>>   create mode 100755 tools/perf/tests/shell/test_arm_coresight_disasm.sh
>>
>> diff --git a/tools/perf/tests/shell/test_arm_coresight_disasm.sh 
>> b/tools/perf/tests/shell/test_arm_coresight_disasm.sh
>> new file mode 100755
>> index 000000000000..6d004bf29f80
>> --- /dev/null
>> +++ b/tools/perf/tests/shell/test_arm_coresight_disasm.sh
>> @@ -0,0 +1,63 @@
>> +#!/bin/sh
>> +# Check Arm CoreSight disassembly script completes without errors
>> +# SPDX-License-Identifier: GPL-2.0
>> +
>> +# The disassembly script reconstructs ranges of instructions and 
>> gives these to objdump to
>> +# decode. objdump doesn't like ranges that go backwards, but these 
>> are a good indication
>> +# that decoding has gone wrong either in OpenCSD, Perf or in the 
>> range reconstruction in
>> +# the script. Test all 3 parts are working correctly by running the 
>> script.
>> +
>> +skip_if_no_cs_etm_event() {
>> +       perf list | grep -q 'cs_etm//' && return 0
>> +
>> +       # cs_etm event doesn't exist
>> +       return 2
>> +}
>> +
>> +skip_if_no_cs_etm_event || exit 2
>> +
>> +# Assume an error unless we reach the very end
>> +set -e
>> +glb_err=1
>> +
>> +perfdata_dir=$(mktemp -d /tmp/__perf_test.perf.data.XXXXX)
>> +perfdata=${perfdata_dir}/perf.data
>> +file=$(mktemp /tmp/temporary_file.XXXXX)
>> +
>> +cleanup_files()
>> +{
>> +       set +e
>> +       rm -rf ${perfdata_dir}
>> +       rm -f ${file}
>> +       trap - EXIT TERM INT
>> +       exit $glb_err
>> +}
>> +
>> +trap cleanup_files EXIT TERM INT
>> +
>> +# Ranges start and end on branches, so check for some likely branch 
>> instructions
>> +sep="\s\|\s"
>> +branch_search="\sbl${sep}b${sep}b.ne${sep}b.eq${sep}cbz\s"
>> +
>> +## Test kernel ##
>> +if [ -e /proc/kcore ]; then
>> +       echo "Testing kernel disassembly"
>> +       perf record -o ${perfdata} -e cs_etm//k --kcore -- touch $file 
>> > /dev/null 2>&1
>> +       perf script -i ${perfdata} -s 
>> python:tools/perf/scripts/python/arm-cs-trace-disasm.py -- \
>> +               -d --stop-sample=30 2> /dev/null > ${file}
> 
> This is fine for self test. But for a CI test in a distro, will it fail to
> find script with prefix 'tools/perf/...'?
> 
> Thanks,
> Leo
> 

Nice catch, it should be this:

   # Relative path works whether it's installed or running from repo
   script_path=$(dirname "$0")/../../scripts/python/arm-cs-trace\
     -disasm.py

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ