Re: [linus:master] [perf symbols] ce4c8e7966: perf-sanity-tests.Test_data_symbol.fail

From: Yujie Liu
Date: Thu Mar 16 2023 - 02:21:58 EST


On Mon, Mar 06, 2023 at 03:20:09PM +0200, Adrian Hunter wrote:
> On 6/03/23 08:30, kernel test robot wrote:
> > Greeting,
> >
> > FYI, we sent a report when this commit was in linux-next/master:
> >
> > https://lore.kernel.org/all/202302092156.c0b14693-oliver.sang@xxxxxxxxx/
> >
> > This commit has been merged to mainline and we still observe similar
> > failures, so we report again FYI.
> >
> > We noticed perf-sanity-tests.Test_data_symbol.fail due to commit (built with gcc-11):
> >
> > commit: ce4c8e7966f317ef2af896778b5fa9105a5cd351 ("perf symbols: Get symbols for .plt.got for x86-64")
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> >
> > [test failed on linux-next/master 1acf39ef8f1425cd105f630dc2c7c1d8fff27ed1]
> >
> > in testcase: perf-sanity-tests
> > version:
> > with following parameters:
> >
> > perf_compiler: clang
> >
> > on test machine: 8 threads 1 sockets Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz (Kaby Lake) with 32G memory
> >
> > caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
> >
> >
> > 2023-02-08 19:29:00 sudo /usr/src/perf_selftests-x86_64-rhel-8.3-func-ce4c8e7966f317ef2af896778b5fa91
> > 05a5cd351/tools/perf/perf test 105
> > 105: Test data symbol : FAILED!
> >
> >
> > =========================================================================================
> > tbox_group/testcase/rootfs/kconfig/compiler/perf_compiler:
> > lkp-kbl-d01/perf-sanity-tests/debian-11.1-x86_64-20220510.cgz/x86_64-rhel-8.3-func/gcc-11/clang
> >
> > commit:
> > 51a188ad8c2d8 ("perf symbols: Start adding support for .plt.got for x86")
> > ce4c8e7966f31 ("perf symbols: Get symbols for .plt.got for x86-64")
> >
> > 51a188ad8c2d89c5 ce4c8e7966f317ef2af896778b5
> > ---------------- ---------------------------
> > fail:runs %reproduction fail:runs
> > | | |
> > :6 50% 3:6 perf-sanity-tests.Check_branch_stack_sampling.fail
> > :6 100% 6:6 perf-sanity-tests.Test_data_symbol.fail
> > :6 33% 2:6 perf-sanity-tests.perf_record_tests.fail
> >
> >
> > If you fix the issue, kindly add following tag
> > | Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>
> > | Link: https://lore.kernel.org/oe-lkp/202303061424.6ad43294-yujie.liu@xxxxxxxxx
> >
> >
> > To reproduce:
> >
> > git clone https://github.com/intel/lkp-tests.git
> > cd lkp-tests
> > sudo bin/lkp install job.yaml # job file is attached in this email
> > bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
> > sudo bin/lkp run generated-yaml-file
> >
> > # if come across any failure that blocks the test,
> > # please remove ~/.lkp and /lkp dir to run from a clean state.
>
> Works fine for me. See below.
>
> You will have to debug your environment:
> Add option -v to perf test (e.g. perf test -c "data symbol") and
> add 'set -x' to tools/perf/tests/shell/test_data_symbol.sh

Thanks for the suggestion on debugging our environment.

We found that we were asked by developers to run perf test with
sanitizer on, so we build perf with some additional flags like
`make EXTRA_CFLAGS="-fsanitize=undefined -fsanitize=address"`, and the
test_data_symbol failure only happens when these flags are set, but
won't happen if do a make without those flags.

Could you please help check if above flags could impact the behavior of
perf test? Thanks.

Here are the test results with and without the flags:

$ make EXTRA_CFLAGS="-fsanitize=undefined -fsanitize=address"
$ ./perf test "data symbol" -v
105: Test data symbol :
--- start ---
test child forked, pid 25107
+ skip_if_no_mem_event
+ perf mem record -e list
+ grep -E -q available
+ return 0
+ TEST_PROGRAM='perf test -w datasym'
++ mktemp /tmp/__perf_test.perf.data.XXXXX
+ PERF_DATA=/tmp/__perf_test.perf.data.t834P
+ trap cleanup_files exit term int
+ echo 'Recording workload...'
Recording workload...
++ grep -E -c 'vendor_id.*AuthenticAMD' /proc/cpuinfo
+ is_amd=0
+ (( 0 >= 1 ))
+ PERFPID=25120
+ sleep 1
+ perf mem record --all-user -o /tmp/__perf_test.perf.data.t834P -- perf test -w datasym
util/util.c:527:2: runtime error: null pointer passed as argument 2, which is declared to never be null
+ kill 25120
+ wait 25120
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.154 MB /tmp/__perf_test.perf.data.t834P (993 samples) ]
+ check_result
++ perf mem report -i /tmp/__perf_test.perf.data.t834P -s symbol_daddr -q
++ awk '/buf1/ { print $4 }'
+ result=
+ '[' -z '' ']'
+ return 1
+ exit 1
+ cleanup_files
+ echo 'Cleaning up files...'
Cleaning up files...
+ rm -f /tmp/__perf_test.perf.data.t834P
test child finished with -1
---- end ----
Test data symbol: FAILED!


$ make
$ ./perf test "data symbol" -v
105: Test data symbol :
--- start ---
test child forked, pid 17241
+ skip_if_no_mem_event
+ perf mem record -e list
+ grep -E -q available
+ return 0
+ TEST_PROGRAM='perf test -w datasym'
++ mktemp /tmp/__perf_test.perf.data.XXXXX
+ PERF_DATA=/tmp/__perf_test.perf.data.qqdDQ
+ trap cleanup_files exit term int
+ echo 'Recording workload...'
Recording workload...
++ grep -E -c 'vendor_id.*AuthenticAMD' /proc/cpuinfo
+ is_amd=0
+ (( 0 >= 1 ))
+ PERFPID=17247
+ sleep 1
+ perf mem record --all-user -o /tmp/__perf_test.perf.data.qqdDQ -- perf test -w datasym
+ kill 17247
+ wait 17247
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.364 MB /tmp/__perf_test.perf.data.qqdDQ (5039 samples) ]
+ check_result
++ perf mem report -i /tmp/__perf_test.perf.data.qqdDQ -s symbol_daddr -q
++ awk '/buf1/ { print $4 }'
+ result='buf1+0x0
buf1+0x38
buf1+0x38
buf1+0x0'
+ '[' -z 'buf1+0x0
buf1+0x38
buf1+0x38
buf1+0x0' ']'
+ IFS=
+ read -r line
+ '[' buf1+0x0 '!=' buf1+0x0 ']'
+ IFS=
+ read -r line
+ '[' buf1+0x38 '!=' buf1+0x0 ']'
+ '[' buf1+0x38 '!=' buf1+0x38 ']'
+ IFS=
+ read -r line
+ '[' buf1+0x38 '!=' buf1+0x0 ']'
+ '[' buf1+0x38 '!=' buf1+0x38 ']'
+ IFS=
+ read -r line
+ '[' buf1+0x0 '!=' buf1+0x0 ']'
+ IFS=
+ read -r line
+ return 0
+ exit 0
+ cleanup_files
+ echo 'Cleaning up files...'
Cleaning up files...
+ rm -f /tmp/__perf_test.perf.data.qqdDQ
test child finished with 0
---- end ----
Test data symbol: Ok


--
Best Regards,
Yujie