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: <YyprNNY/1dPiaq7v@leoy-yangtze.lan>
Date:   Wed, 21 Sep 2022 09:39:00 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-perf-users <linux-perf-users@...r.kernel.org>
Subject: Re: [PATCH RESEND v2] perf test: Introduce script for data symbol
 testing

Hi Namhyung,

On Tue, Sep 20, 2022 at 03:15:42PM -0700, Namhyung Kim wrote:

[...]

> > +check_result() {
> > +       # The memory report format is as below:
> > +       #    99.92%  ...  [.] buf1+0x38  ...
> > +       result=$(perf mem report -i ${PERF_DATA} --stdio 2>&1 | egrep "buf1" | \
> > +               awk '{ for (i = 1; i <= NF; i++) { if ($i ~ /^buf1/) { print $i; break; } } }')
> 
> It'd be simpler to use the 'symbol_daddr' sort key alone.
> 
>   result=$(perf mem report -i ${PERF_DATA} -s symbol_daddr -q 2>&1 | \
>         awk '/buf1/ { print $4 }'

Yeah, it's better with 'symbol_daddr', will try it out.

> > +
> > +       # Testing is failed if has no any sample for "buf1"
> > +       [ -z "$result" ] && return 1
> > +
> > +       while IFS= read -r line; do
> > +               # The "data1" and "data2" fields in structure "buf1" have
> > +               # offset "0x0" and "0x38", returns failure if detect any
> > +               # other offset value.
> > +               if [ "$line" != "buf1+0x0" ] && [ "$line" != "buf1+0x38" ]; then
> > +                       return 1
> > +               fi
> > +       done <<< "$result"
> > +
> > +       return 0
> > +}
> > +
> > +cleanup_files()
> > +{
> > +       echo "Cleaning up files..."
> > +       rm -f ${PERF_DATA}
> > +       rm -f ${TEST_PROGRAM_SOURCE}
> > +       rm -f ${TEST_PROGRAM}
> > +}
> > +
> > +trap cleanup_files exit term int
> > +
> > +# compile test program
> > +cat << EOF > $TEST_PROGRAM_SOURCE
> 
> You could directly call the compiler with a pipe.

Yeah, will refine.

> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include <unistd.h>
> 
> The headers are not used?

Will remove.

> > +
> > +typedef struct _buf {
> > +       char data1;
> > +       char reserved[55];
> > +       char data2;
> > +} buf __attribute__((aligned(64)));
> > +
> > +static buf buf1;
> > +
> > +int main() {
> 
> s/()/(void)/
> 
> > +       int i;
> 
> unused.

Will update for above comments.

Thanks a lot for suggestions.

Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ