linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 'perf stat --bpf-counters test' failures
@ 2021-11-19 12:28 Arnaldo Carvalho de Melo
  2021-11-19 14:08 ` Jiri Olsa
  0 siblings, 1 reply; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-11-19 12:28 UTC (permalink / raw)
  To: Song Liu; +Cc: Jiri Olsa, Namhyung Kim, Ian Rogers, Linux Kernel Mailing List


After I updated to fedora 35 I started seeing the errors below,
it may well not be related to that, maybe something on libbpf, haven't
investigated, have you seen this?

⬢[acme@toolbox perf]$ perf -vv
perf version 5.16.rc1.gfa2b5229b222
                 dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
    dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                 glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
         syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
               libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
               libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
              libslang: [ on  ]  # HAVE_SLANG_SUPPORT
             libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
             libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
    libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                  zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                  lzma: [ on  ]  # HAVE_LZMA_SUPPORT
             get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                   bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                   aio: [ on  ]  # HAVE_AIO_SUPPORT
                  zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
               libpfm4: [ OFF ]  # HAVE_LIBPFM
⬢[acme@toolbox perf]$

This is with what I have now in my perf/urgent branch, the csets there
aren't related:

⬢[acme@toolbox perf]$ git log --oneline torvalds/master..
b194c9cd09dd98af (HEAD -> perf/urgent, quaco/perf/urgent, acme/tmp.perf/urgent, acme/perf/urgent) perf evsel: Fix memory leaks relating to unit
d9fc706108c15f8b perf report: Fix memory leaks around perf_tip()
0ca1f534a776cc7d perf hist: Fix memory leak of a perf_hpp_fmt
8b8dcc3720d57d88 tools headers UAPI: Sync MIPS syscall table file changed by new futex_waitv syscall
e8c04ea0fef5731d tools build: Fix removal of feature-sync-compare-and-swap feature detection
9e1a8d9f683260d5 perf inject: Fix ARM SPE handling
92723ea0f11d9249 perf bench: Fix two memory leaks detected with ASan
cb5a63feae2d963c perf test sample-parsing: Fix branch_stack entry endianness check
162b944598344fd7 tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources
db4b284029099224 perf sort: Fix the 'p_stage_cyc' sort key behavior
4d03c75363eeca86 perf sort: Fix the 'ins_lat' sort key behavior
784e8adda4cdb3e2 perf sort: Fix the 'weight' sort key behavior
70f9c9b2df1dd12c perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1
ccb05590c4325ce5 perf tests wp: Remove unused functions on s390
346e91998cba46b6 tools headers UAPI: Sync linux/kvm.h with the kernel sources
b075c1d81e7d0e96 tools headers cpufeatures: Sync with the kernel sources
⬢[acme@toolbox perf]$

- Arnaldo

[acme@quaco perf]$ uname -a
Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
92: Check Arm CoreSight trace data recording and synthesized samples: Skip
93: Check Arm SPE trace data recording and synthesized samples      : Skip
94: Check open filename arg using perf trace + vfs_getname          : Ok
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRRRRR FAILED!
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRRRRR Ok
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRR FAILED!
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRRRR Ok
[root@quaco ~]# perf test 91
91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRR Ok
[root@quaco ~]# uname -a
Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@quaco ~]# set -o vi
[root@quaco ~]# perf test -v 91
91: perf stat --bpf-counters test                                   :
--- start ---
test child forked, pid 30079
RRRRRRRRRRRRRRRRRThe difference between 31599305 and 36265639 are greater than 10%.
test child finished with -1
---- end ----
perf stat --bpf-counters test: FAILED!
[root@quaco ~]# perf test -v 91
91: perf stat --bpf-counters test                                   :
--- start ---
test child forked, pid 30170
RRRRRRRRRRRRRRRRRRRRRRRRThe difference between 33311934 and 36973889 are greater than 10%.
test child finished with -1
---- end ----
perf stat --bpf-counters test: FAILED!
[root@quaco ~]# perf test -v 91
91: perf stat --bpf-counters test                                   :
--- start ---
test child forked, pid 30257
RRRRRRRRRRRRRRRRRThe difference between 31420157 and 36680527 are greater than 10%.
test child finished with -1
---- end ----
perf stat --bpf-counters test: FAILED!
[root@quaco ~]# perf test -v 91
91: perf stat --bpf-counters test                                   :
--- start ---
test child forked, pid 30341
RRRRRRRRRRRRRRRRRRRThe difference between 32451720 and 36750342 are greater than 10%.
test child finished with -1
---- end ----
perf stat --bpf-counters test: FAILED!
[root@quaco ~]# perf test -v 91
91: perf stat --bpf-counters test                                   :
--- start ---
test child forked, pid 30433
RRRRRRRRRRRRRRRRRRtest child finished with 0
---- end ----
perf stat --bpf-counters test: Ok
[root@quaco ~]#

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: 'perf stat --bpf-counters test' failures
  2021-11-19 12:28 'perf stat --bpf-counters test' failures Arnaldo Carvalho de Melo
@ 2021-11-19 14:08 ` Jiri Olsa
  2021-11-20  0:26   ` Namhyung Kim
                     ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jiri Olsa @ 2021-11-19 14:08 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Sohaib Mohamed
  Cc: Song Liu, Jiri Olsa, Namhyung Kim, Ian Rogers, Linux Kernel Mailing List

On Fri, Nov 19, 2021 at 09:28:15AM -0300, Arnaldo Carvalho de Melo wrote:
> 
> After I updated to fedora 35 I started seeing the errors below,
> it may well not be related to that, maybe something on libbpf, haven't
> investigated, have you seen this?

yep, it seems the perf bench is broken so the counts won't correlated
if I revert this one:
  92723ea0f11d perf bench: Fix two memory leaks detected with ASan

it works for me again.. it seems to break -t option

Sohaib, could you please check on that?

	[root@dell-r440-01 perf]# ./perf bench sched messaging -g 1 -l 100 -t
	# Running 'sched/messaging' benchmark:
	RRRperf: CLIENT: ready write: Bad file descriptor
	Rperf: SENDER: write: Bad file descriptor

thanks,
jirka

> 
> ⬢[acme@toolbox perf]$ perf -vv
> perf version 5.16.rc1.gfa2b5229b222
>                  dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
>     dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
>                  glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
>          syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
>                 libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
>                 libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
>                libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
>                libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
>              libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
>               libslang: [ on  ]  # HAVE_SLANG_SUPPORT
>              libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
>              libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
>     libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
>                   zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
>                   lzma: [ on  ]  # HAVE_LZMA_SUPPORT
>              get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
>                    bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
>                    aio: [ on  ]  # HAVE_AIO_SUPPORT
>                   zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
>                libpfm4: [ OFF ]  # HAVE_LIBPFM
> ⬢[acme@toolbox perf]$
> 
> This is with what I have now in my perf/urgent branch, the csets there
> aren't related:
> 
> ⬢[acme@toolbox perf]$ git log --oneline torvalds/master..
> b194c9cd09dd98af (HEAD -> perf/urgent, quaco/perf/urgent, acme/tmp.perf/urgent, acme/perf/urgent) perf evsel: Fix memory leaks relating to unit
> d9fc706108c15f8b perf report: Fix memory leaks around perf_tip()
> 0ca1f534a776cc7d perf hist: Fix memory leak of a perf_hpp_fmt
> 8b8dcc3720d57d88 tools headers UAPI: Sync MIPS syscall table file changed by new futex_waitv syscall
> e8c04ea0fef5731d tools build: Fix removal of feature-sync-compare-and-swap feature detection
> 9e1a8d9f683260d5 perf inject: Fix ARM SPE handling
> 92723ea0f11d9249 perf bench: Fix two memory leaks detected with ASan
> cb5a63feae2d963c perf test sample-parsing: Fix branch_stack entry endianness check
> 162b944598344fd7 tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources
> db4b284029099224 perf sort: Fix the 'p_stage_cyc' sort key behavior
> 4d03c75363eeca86 perf sort: Fix the 'ins_lat' sort key behavior
> 784e8adda4cdb3e2 perf sort: Fix the 'weight' sort key behavior
> 70f9c9b2df1dd12c perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1
> ccb05590c4325ce5 perf tests wp: Remove unused functions on s390
> 346e91998cba46b6 tools headers UAPI: Sync linux/kvm.h with the kernel sources
> b075c1d81e7d0e96 tools headers cpufeatures: Sync with the kernel sources
> ⬢[acme@toolbox perf]$
> 
> - Arnaldo
> 
> [acme@quaco perf]$ uname -a
> Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> 
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> 92: Check Arm CoreSight trace data recording and synthesized samples: Skip
> 93: Check Arm SPE trace data recording and synthesized samples      : Skip
> 94: Check open filename arg using perf trace + vfs_getname          : Ok
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRR FAILED!
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRRRRR Ok
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRR FAILED!
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRR Ok
> [root@quaco ~]# perf test 91
> 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRR Ok
> [root@quaco ~]# uname -a
> Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> [root@quaco ~]# set -o vi
> [root@quaco ~]# perf test -v 91
> 91: perf stat --bpf-counters test                                   :
> --- start ---
> test child forked, pid 30079
> RRRRRRRRRRRRRRRRRThe difference between 31599305 and 36265639 are greater than 10%.
> test child finished with -1
> ---- end ----
> perf stat --bpf-counters test: FAILED!
> [root@quaco ~]# perf test -v 91
> 91: perf stat --bpf-counters test                                   :
> --- start ---
> test child forked, pid 30170
> RRRRRRRRRRRRRRRRRRRRRRRRThe difference between 33311934 and 36973889 are greater than 10%.
> test child finished with -1
> ---- end ----
> perf stat --bpf-counters test: FAILED!
> [root@quaco ~]# perf test -v 91
> 91: perf stat --bpf-counters test                                   :
> --- start ---
> test child forked, pid 30257
> RRRRRRRRRRRRRRRRRThe difference between 31420157 and 36680527 are greater than 10%.
> test child finished with -1
> ---- end ----
> perf stat --bpf-counters test: FAILED!
> [root@quaco ~]# perf test -v 91
> 91: perf stat --bpf-counters test                                   :
> --- start ---
> test child forked, pid 30341
> RRRRRRRRRRRRRRRRRRRThe difference between 32451720 and 36750342 are greater than 10%.
> test child finished with -1
> ---- end ----
> perf stat --bpf-counters test: FAILED!
> [root@quaco ~]# perf test -v 91
> 91: perf stat --bpf-counters test                                   :
> --- start ---
> test child forked, pid 30433
> RRRRRRRRRRRRRRRRRRtest child finished with 0
> ---- end ----
> perf stat --bpf-counters test: Ok
> [root@quaco ~]#
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: 'perf stat --bpf-counters test' failures
  2021-11-19 14:08 ` Jiri Olsa
@ 2021-11-20  0:26   ` Namhyung Kim
  2021-11-20  1:06   ` Sohaib Mohamed
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2021-11-20  0:26 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Sohaib Mohamed, Song Liu, Jiri Olsa,
	Ian Rogers, Linux Kernel Mailing List

Hello,

On Fri, Nov 19, 2021 at 6:08 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Fri, Nov 19, 2021 at 09:28:15AM -0300, Arnaldo Carvalho de Melo wrote:
> >
> > After I updated to fedora 35 I started seeing the errors below,
> > it may well not be related to that, maybe something on libbpf, haven't
> > investigated, have you seen this?
>
> yep, it seems the perf bench is broken so the counts won't correlated
> if I revert this one:
>   92723ea0f11d perf bench: Fix two memory leaks detected with ASan
>
> it works for me again.. it seems to break -t option

Right, it should free the ctx after the thread finishes the work.

Thanks,
Namhyung


>
> Sohaib, could you please check on that?
>
>         [root@dell-r440-01 perf]# ./perf bench sched messaging -g 1 -l 100 -t
>         # Running 'sched/messaging' benchmark:
>         RRRperf: CLIENT: ready write: Bad file descriptor
>         Rperf: SENDER: write: Bad file descriptor

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: 'perf stat --bpf-counters test' failures
  2021-11-19 14:08 ` Jiri Olsa
  2021-11-20  0:26   ` Namhyung Kim
@ 2021-11-20  1:06   ` Sohaib Mohamed
  2021-11-20  4:08   ` [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan Sohaib Mohamed
  2021-11-22 13:08   ` 'perf stat --bpf-counters test' failures Arnaldo Carvalho de Melo
  3 siblings, 0 replies; 9+ messages in thread
From: Sohaib Mohamed @ 2021-11-20  1:06 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Arnaldo Carvalho de Melo, Song Liu, Jiri Olsa, Namhyung Kim,
	Ian Rogers, Linux Kernel Mailing List

Hello, Jiri

On Fri, Nov 19, 2021 at 03:08:44PM +0100, Jiri Olsa wrote:
> On Fri, Nov 19, 2021 at 09:28:15AM -0300, Arnaldo Carvalho de Melo wrote:
> >
> > After I updated to fedora 35 I started seeing the errors below,
> > it may well not be related to that, maybe something on libbpf, haven't
> > investigated, have you seen this?
>
> yep, it seems the perf bench is broken so the counts won't correlated
> if I revert this one:
>   92723ea0f11d perf bench: Fix two memory leaks detected with ASan
>
> it works for me again.. it seems to break -t option
>
> Sohaib, could you please check on that?
>
> 	[root@dell-r440-01 perf]# ./perf bench sched messaging -g 1 -l 100 -t
> 	# Running 'sched/messaging' benchmark:
> 	RRRperf: CLIENT: ready write: Bad file descriptor
> 	Rperf: SENDER: write: Bad file descriptor
>

It seems that this patch fixes this:
$ perf bench sched all
and break:
$ perf bench sched messaging -g 1 -l 100 -t

I'll try to fix this now, apologies

Thanks,
- Sohaib

> thanks,
> jirka
>
> >
> > ⬢[acme@toolbox perf]$ perf -vv
> > perf version 5.16.rc1.gfa2b5229b222
> >                  dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
> >     dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
> >                  glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
> >          syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
> >                 libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
> >                 libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
> >                libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> > numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> >                libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
> >              libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
> >               libslang: [ on  ]  # HAVE_SLANG_SUPPORT
> >              libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
> >              libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
> >     libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
> >                   zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
> >                   lzma: [ on  ]  # HAVE_LZMA_SUPPORT
> >              get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
> >                    bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
> >                    aio: [ on  ]  # HAVE_AIO_SUPPORT
> >                   zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
> >                libpfm4: [ OFF ]  # HAVE_LIBPFM
> > ⬢[acme@toolbox perf]$
> >
> > This is with what I have now in my perf/urgent branch, the csets there
> > aren't related:
> >
> > ⬢[acme@toolbox perf]$ git log --oneline torvalds/master..
> > b194c9cd09dd98af (HEAD -> perf/urgent, quaco/perf/urgent, acme/tmp.perf/urgent, acme/perf/urgent) perf evsel: Fix memory leaks relating to unit
> > d9fc706108c15f8b perf report: Fix memory leaks around perf_tip()
> > 0ca1f534a776cc7d perf hist: Fix memory leak of a perf_hpp_fmt
> > 8b8dcc3720d57d88 tools headers UAPI: Sync MIPS syscall table file changed by new futex_waitv syscall
> > e8c04ea0fef5731d tools build: Fix removal of feature-sync-compare-and-swap feature detection
> > 9e1a8d9f683260d5 perf inject: Fix ARM SPE handling
> > 92723ea0f11d9249 perf bench: Fix two memory leaks detected with ASan
> > cb5a63feae2d963c perf test sample-parsing: Fix branch_stack entry endianness check
> > 162b944598344fd7 tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources
> > db4b284029099224 perf sort: Fix the 'p_stage_cyc' sort key behavior
> > 4d03c75363eeca86 perf sort: Fix the 'ins_lat' sort key behavior
> > 784e8adda4cdb3e2 perf sort: Fix the 'weight' sort key behavior
> > 70f9c9b2df1dd12c perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1
> > ccb05590c4325ce5 perf tests wp: Remove unused functions on s390
> > 346e91998cba46b6 tools headers UAPI: Sync linux/kvm.h with the kernel sources
> > b075c1d81e7d0e96 tools headers cpufeatures: Sync with the kernel sources
> > ⬢[acme@toolbox perf]$
> >
> > - Arnaldo
> >
> > [acme@quaco perf]$ uname -a
> > Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> >
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > 92: Check Arm CoreSight trace data recording and synthesized samples: Skip
> > 93: Check Arm SPE trace data recording and synthesized samples      : Skip
> > 94: Check open filename arg using perf trace + vfs_getname          : Ok
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRRRRR Ok
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRR Ok
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRR Ok
> > [root@quaco ~]# uname -a
> > Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> > [root@quaco ~]# set -o vi
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30079
> > RRRRRRRRRRRRRRRRRThe difference between 31599305 and 36265639 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30170
> > RRRRRRRRRRRRRRRRRRRRRRRRThe difference between 33311934 and 36973889 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30257
> > RRRRRRRRRRRRRRRRRThe difference between 31420157 and 36680527 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30341
> > RRRRRRRRRRRRRRRRRRRThe difference between 32451720 and 36750342 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30433
> > RRRRRRRRRRRRRRRRRRtest child finished with 0
> > ---- end ----
> > perf stat --bpf-counters test: Ok
> > [root@quaco ~]#
> >
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan
  2021-11-19 14:08 ` Jiri Olsa
  2021-11-20  0:26   ` Namhyung Kim
  2021-11-20  1:06   ` Sohaib Mohamed
@ 2021-11-20  4:08   ` Sohaib Mohamed
  2021-11-20  6:53     ` Ahmad Fatoum
  2021-11-22 13:08   ` 'perf stat --bpf-counters test' failures Arnaldo Carvalho de Melo
  3 siblings, 1 reply; 9+ messages in thread
From: Sohaib Mohamed @ 2021-11-20  4:08 UTC (permalink / raw)
  To: jolsa
  Cc: acme, irogers, jolsa, linux-kernel, namhyung, sohaib.amhmd,
	songliubraving

Fixes: 92723ea0f11d ("perf bench: Fix two memory leaks detected with
ASan")

This patch fixes the previous patch which frees the ctx before
the thread finishes the work. This break -t option.

This patch stores all overwritten pointers in a global vars then free
them at the end of the program.

Tests:
$ perf bench sched messaging -g 1 -l 100 -t
$ perf bench sched messaging -g 1 -l 100
$ perf bench sched all

Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
---
 tools/perf/bench/sched-messaging.c | 39 +++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index 488f6e6ba1a5..f60dc9c36f4e 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -30,11 +30,15 @@
 #include <linux/time64.h>

 #define DATASIZE 100
+#define GROUPS_NUM 10
+#define FD_NUM 20

 static bool use_pipes = false;
 static unsigned int nr_loops = 100;
 static bool thread_mode = false;
-static unsigned int num_groups = 10;
+static unsigned int num_groups = GROUPS_NUM;
+static unsigned int num_fds = FD_NUM;
+static unsigned int total_counter; /* num_groups * num_fds */

 struct sender_context {
 	unsigned int num_fds;
@@ -50,6 +54,9 @@ struct receiver_context {
 	int wakefd;
 };

+struct receiver_context *ctx_arr[FD_NUM*GROUPS_NUM];
+struct sender_context *snd_ctx_arr[FD_NUM*GROUPS_NUM];
+
 static void fdpair(int fds[2])
 {
 	if (use_pipes) {
@@ -190,29 +197,30 @@ static void reap_worker(pthread_t id)

 /* One group of senders and receivers */
 static unsigned int group(pthread_t *pth,
-		unsigned int num_fds,
+		unsigned int num_fd,
 		int ready_out,
 		int wakefd)
 {
 	unsigned int i;
 	struct sender_context *snd_ctx = malloc(sizeof(struct sender_context)
-			+ num_fds * sizeof(int));
+			+ num_fd * sizeof(int));

 	if (!snd_ctx)
 		err(EXIT_FAILURE, "malloc()");

-	for (i = 0; i < num_fds; i++) {
+	for (i = 0; i < num_fd; i++) {
 		int fds[2];
 		struct receiver_context *ctx = malloc(sizeof(*ctx));

 		if (!ctx)
 			err(EXIT_FAILURE, "malloc()");

+		total_counter++;

 		/* Create the pipe between client and server */
 		fdpair(fds);

-		ctx->num_packets = num_fds * nr_loops;
+		ctx->num_packets = num_fd * nr_loops;
 		ctx->in_fds[0] = fds[0];
 		ctx->in_fds[1] = fds[1];
 		ctx->ready_out = ready_out;
@@ -223,24 +231,28 @@ static unsigned int group(pthread_t *pth,
 		snd_ctx->out_fds[i] = fds[1];
 		if (!thread_mode)
 			close(fds[0]);
+
+		ctx_arr[total_counter] = ctx;
 	}

 	/* Now we have all the fds, fork the senders */
-	for (i = 0; i < num_fds; i++) {
+	for (i = 0; i < num_fd; i++) {
 		snd_ctx->ready_out = ready_out;
 		snd_ctx->wakefd = wakefd;
-		snd_ctx->num_fds = num_fds;
+		snd_ctx->num_fds = num_fd;

-		pth[num_fds+i] = create_worker(snd_ctx, (void *)sender);
+		pth[num_fd+i] = create_worker(snd_ctx, (void *)sender);
 	}

 	/* Close the fds we have left */
 	if (!thread_mode)
-		for (i = 0; i < num_fds; i++)
+		for (i = 0; i < num_fd; i++)
 			close(snd_ctx->out_fds[i]);

+	snd_ctx_arr[total_counter] = snd_ctx;
+
 	/* Return number of children to reap */
-	return num_fds * 2;
+	return num_fd * 2;
 }

 static const struct option options[] = {
@@ -262,7 +274,6 @@ int bench_sched_messaging(int argc, const char **argv)
 {
 	unsigned int i, total_children;
 	struct timeval start, stop, diff;
-	unsigned int num_fds = 20;
 	int readyfds[2], wakefds[2];
 	char dummy;
 	pthread_t *pth_tab;
@@ -287,6 +298,7 @@ int bench_sched_messaging(int argc, const char **argv)
 		if (read(readyfds[0], &dummy, 1) != 1)
 			err(EXIT_FAILURE, "Reading for readyfds");

+
 	gettimeofday(&start, NULL);

 	/* Kick them off */
@@ -323,6 +335,11 @@ int bench_sched_messaging(int argc, const char **argv)
 		break;
 	}

+	/* Free malloc's */
+	for (i = 0; i < FD_NUM * GROUPS_NUM; i++) {
+		free(ctx_arr[i]);
+		free(snd_ctx_arr[i]);
+	}
 	free(pth_tab);

 	return 0;
--
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan
  2021-11-20  4:08   ` [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan Sohaib Mohamed
@ 2021-11-20  6:53     ` Ahmad Fatoum
  2021-11-20  7:08       ` Ahmad Fatoum
  0 siblings, 1 reply; 9+ messages in thread
From: Ahmad Fatoum @ 2021-11-20  6:53 UTC (permalink / raw)
  To: Sohaib Mohamed, jolsa
  Cc: acme, irogers, jolsa, linux-kernel, namhyung, songliubraving

Hello Sohaib,

On 20.11.21 05:08, Sohaib Mohamed wrote:
> Fixes: 92723ea0f11d ("perf bench: Fix two memory leaks detected with
> ASan")

Fixes and other tags are usually at the end, but before the S-o-b's,
Tested-by's and such.

> This patch fixes the previous patch which frees the ctx before
> the thread finishes the work. This break -t option.
>
> This patch stores all overwritten pointers in a global vars then free
> them at the end of the program.

Clean up is complicated a bit, because the worker may either be forked
off (so each main and worker has its own allocation) or threaded (with
same allocation for both).

I wouldn't bother to fix small leaks in a short running application to be
honest, but still some review below:

> 
> Tests:
> $ perf bench sched messaging -g 1 -l 100 -t
> $ perf bench sched messaging -g 1 -l 100
> $ perf bench sched all
> 
> Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
> ---
>  tools/perf/bench/sched-messaging.c | 39 +++++++++++++++++++++---------
>  1 file changed, 28 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
> index 488f6e6ba1a5..f60dc9c36f4e 100644
> --- a/tools/perf/bench/sched-messaging.c
> +++ b/tools/perf/bench/sched-messaging.c
> @@ -30,11 +30,15 @@
>  #include <linux/time64.h>
> 
>  #define DATASIZE 100
> +#define GROUPS_NUM 10
> +#define FD_NUM 20
> 
>  static bool use_pipes = false;
>  static unsigned int nr_loops = 100;
>  static bool thread_mode = false;
> -static unsigned int num_groups = 10;
> +static unsigned int num_groups = GROUPS_NUM;

Why is this a variable? Looks like it's never changed

> +static unsigned int num_fds = FD_NUM;

Same here

> +static unsigned int total_counter; /* num_groups * num_fds */
> 
>  struct sender_context {
>  	unsigned int num_fds;
> @@ -50,6 +54,9 @@ struct receiver_context {
>  	int wakefd;
>  };
> 
> +struct receiver_context *ctx_arr[FD_NUM*GROUPS_NUM];
> +struct sender_context *snd_ctx_arr[FD_NUM*GROUPS_NUM];
> +
>  static void fdpair(int fds[2])
>  {
>  	if (use_pipes) {
> @@ -190,29 +197,30 @@ static void reap_worker(pthread_t id)
> 
>  /* One group of senders and receivers */
>  static unsigned int group(pthread_t *pth,
> -		unsigned int num_fds,
> +		unsigned int num_fd,

Especially fixes should be as short as possible. Renaming this variable
could've been avoided.

>  		int ready_out,
>  		int wakefd)
>  {
>  	unsigned int i;
>  	struct sender_context *snd_ctx = malloc(sizeof(struct sender_context)
> -			+ num_fds * sizeof(int));
> +			+ num_fd * sizeof(int));
> 
>  	if (!snd_ctx)
>  		err(EXIT_FAILURE, "malloc()");
> 
> -	for (i = 0; i < num_fds; i++) {
> +	for (i = 0; i < num_fd; i++) {
>  		int fds[2];
>  		struct receiver_context *ctx = malloc(sizeof(*ctx));
> 
>  		if (!ctx)
>  			err(EXIT_FAILURE, "malloc()");
> 
> +		total_counter++;
> 
>  		/* Create the pipe between client and server */
>  		fdpair(fds);
> 
> -		ctx->num_packets = num_fds * nr_loops;
> +		ctx->num_packets = num_fd * nr_loops;
>  		ctx->in_fds[0] = fds[0];
>  		ctx->in_fds[1] = fds[1];
>  		ctx->ready_out = ready_out;
> @@ -223,24 +231,28 @@ static unsigned int group(pthread_t *pth,
>  		snd_ctx->out_fds[i] = fds[1];
>  		if (!thread_mode)
>  			close(fds[0]);
> +
> +		ctx_arr[total_counter] = ctx;

You could've done the total_counter++ here, which makes the relation easier
to follow.

>  	}
> 
>  	/* Now we have all the fds, fork the senders */
> -	for (i = 0; i < num_fds; i++) {
> +	for (i = 0; i < num_fd; i++) {
>  		snd_ctx->ready_out = ready_out;
>  		snd_ctx->wakefd = wakefd;
> -		snd_ctx->num_fds = num_fds;
> +		snd_ctx->num_fds = num_fd;
> 
> -		pth[num_fds+i] = create_worker(snd_ctx, (void *)sender);
> +		pth[num_fd+i] = create_worker(snd_ctx, (void *)sender);
>  	}
> 
>  	/* Close the fds we have left */
>  	if (!thread_mode)
> -		for (i = 0; i < num_fds; i++)
> +		for (i = 0; i < num_fd; i++)
>  			close(snd_ctx->out_fds[i]);
> 
> +	snd_ctx_arr[total_counter] = snd_ctx;

You are storing at snd_ctx_arr[num_fd] each time, so you will leak
all context, except for the last one.

> +
>  	/* Return number of children to reap */
> -	return num_fds * 2;
> +	return num_fd * 2;
>  }
> 
>  static const struct option options[] = {
> @@ -262,7 +274,6 @@ int bench_sched_messaging(int argc, const char **argv)
>  {
>  	unsigned int i, total_children;
>  	struct timeval start, stop, diff;
> -	unsigned int num_fds = 20;
>  	int readyfds[2], wakefds[2];
>  	char dummy;
>  	pthread_t *pth_tab;
> @@ -287,6 +298,7 @@ int bench_sched_messaging(int argc, const char **argv)
>  		if (read(readyfds[0], &dummy, 1) != 1)
>  			err(EXIT_FAILURE, "Reading for readyfds");
> 
> +

Unneeded space.

>  	gettimeofday(&start, NULL);
> 
>  	/* Kick them off */
> @@ -323,6 +335,11 @@ int bench_sched_messaging(int argc, const char **argv)
>  		break;
>  	}
> 
> +	/* Free malloc's */

Unneeded comment.

> +	for (i = 0; i < FD_NUM * GROUPS_NUM; i++) {
> +		free(ctx_arr[i]);
> +		free(snd_ctx_arr[i]);
> +	}

At least in the threaded case, file descriptors are leaked and there's more
memory associated with them than with the context structs you are freeing here.

If you are serious about fixing leaks, I think both should be fixed together, 
so I am in favor of just reverting the other patch for now.

Cheers,
Ahmad

>  	free(pth_tab);
> 
>  	return 0;
> --
> 2.25.1
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan
  2021-11-20  6:53     ` Ahmad Fatoum
@ 2021-11-20  7:08       ` Ahmad Fatoum
  0 siblings, 0 replies; 9+ messages in thread
From: Ahmad Fatoum @ 2021-11-20  7:08 UTC (permalink / raw)
  To: Sohaib Mohamed, jolsa
  Cc: acme, irogers, jolsa, linux-kernel, namhyung, songliubraving

On 20.11.21 07:53, Ahmad Fatoum wrote:
>> +	snd_ctx_arr[total_counter] = snd_ctx;
> 
> You are storing at snd_ctx_arr[num_fd] each time, so you will leak
> all context, except for the last one.

Oh, it's more subtle than that. total_counter is of course incremented
every time in the previous loop, so you will have num_fd times NULL
(from static initialization) then a pointer to an allocation and so on.
That works by the looks of it, but looks quite strange.


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: 'perf stat --bpf-counters test' failures
  2021-11-19 14:08 ` Jiri Olsa
                     ` (2 preceding siblings ...)
  2021-11-20  4:08   ` [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan Sohaib Mohamed
@ 2021-11-22 13:08   ` Arnaldo Carvalho de Melo
  2021-11-22 13:16     ` Jiri Olsa
  3 siblings, 1 reply; 9+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-11-22 13:08 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Sohaib Mohamed, Song Liu, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Linux Kernel Mailing List

Em Fri, Nov 19, 2021 at 03:08:44PM +0100, Jiri Olsa escreveu:
> On Fri, Nov 19, 2021 at 09:28:15AM -0300, Arnaldo Carvalho de Melo wrote:
> > 
> > After I updated to fedora 35 I started seeing the errors below,
> > it may well not be related to that, maybe something on libbpf, haven't
> > investigated, have you seen this?
> 
> yep, it seems the perf bench is broken so the counts won't correlated
> if I revert this one:
>   92723ea0f11d perf bench: Fix two memory leaks detected with ASan
> 
> it works for me again.. it seems to break -t option
> 
> Sohaib, could you please check on that?
> 
> 	[root@dell-r440-01 perf]# ./perf bench sched messaging -g 1 -l 100 -t
> 	# Running 'sched/messaging' benchmark:
> 	RRRperf: CLIENT: ready write: Bad file descriptor
> 	Rperf: SENDER: write: Bad file descriptor

I'm reverting that patch, with you as the author of the revert, ok?

- Arnaldo
 
> thanks,
> jirka
> 
> > 
> > ⬢[acme@toolbox perf]$ perf -vv
> > perf version 5.16.rc1.gfa2b5229b222
> >                  dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
> >     dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
> >                  glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
> >          syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
> >                 libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
> >                 libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
> >                libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> > numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> >                libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
> >              libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
> >               libslang: [ on  ]  # HAVE_SLANG_SUPPORT
> >              libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
> >              libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
> >     libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
> >                   zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
> >                   lzma: [ on  ]  # HAVE_LZMA_SUPPORT
> >              get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
> >                    bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
> >                    aio: [ on  ]  # HAVE_AIO_SUPPORT
> >                   zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
> >                libpfm4: [ OFF ]  # HAVE_LIBPFM
> > ⬢[acme@toolbox perf]$
> > 
> > This is with what I have now in my perf/urgent branch, the csets there
> > aren't related:
> > 
> > ⬢[acme@toolbox perf]$ git log --oneline torvalds/master..
> > b194c9cd09dd98af (HEAD -> perf/urgent, quaco/perf/urgent, acme/tmp.perf/urgent, acme/perf/urgent) perf evsel: Fix memory leaks relating to unit
> > d9fc706108c15f8b perf report: Fix memory leaks around perf_tip()
> > 0ca1f534a776cc7d perf hist: Fix memory leak of a perf_hpp_fmt
> > 8b8dcc3720d57d88 tools headers UAPI: Sync MIPS syscall table file changed by new futex_waitv syscall
> > e8c04ea0fef5731d tools build: Fix removal of feature-sync-compare-and-swap feature detection
> > 9e1a8d9f683260d5 perf inject: Fix ARM SPE handling
> > 92723ea0f11d9249 perf bench: Fix two memory leaks detected with ASan
> > cb5a63feae2d963c perf test sample-parsing: Fix branch_stack entry endianness check
> > 162b944598344fd7 tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources
> > db4b284029099224 perf sort: Fix the 'p_stage_cyc' sort key behavior
> > 4d03c75363eeca86 perf sort: Fix the 'ins_lat' sort key behavior
> > 784e8adda4cdb3e2 perf sort: Fix the 'weight' sort key behavior
> > 70f9c9b2df1dd12c perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1
> > ccb05590c4325ce5 perf tests wp: Remove unused functions on s390
> > 346e91998cba46b6 tools headers UAPI: Sync linux/kvm.h with the kernel sources
> > b075c1d81e7d0e96 tools headers cpufeatures: Sync with the kernel sources
> > ⬢[acme@toolbox perf]$
> > 
> > - Arnaldo
> > 
> > [acme@quaco perf]$ uname -a
> > Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> > 
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > 92: Check Arm CoreSight trace data recording and synthesized samples: Skip
> > 93: Check Arm SPE trace data recording and synthesized samples      : Skip
> > 94: Check open filename arg using perf trace + vfs_getname          : Ok
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRRRRR Ok
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRR FAILED!
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRR Ok
> > [root@quaco ~]# perf test 91
> > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRR Ok
> > [root@quaco ~]# uname -a
> > Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> > [root@quaco ~]# set -o vi
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30079
> > RRRRRRRRRRRRRRRRRThe difference between 31599305 and 36265639 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30170
> > RRRRRRRRRRRRRRRRRRRRRRRRThe difference between 33311934 and 36973889 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30257
> > RRRRRRRRRRRRRRRRRThe difference between 31420157 and 36680527 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30341
> > RRRRRRRRRRRRRRRRRRRThe difference between 32451720 and 36750342 are greater than 10%.
> > test child finished with -1
> > ---- end ----
> > perf stat --bpf-counters test: FAILED!
> > [root@quaco ~]# perf test -v 91
> > 91: perf stat --bpf-counters test                                   :
> > --- start ---
> > test child forked, pid 30433
> > RRRRRRRRRRRRRRRRRRtest child finished with 0
> > ---- end ----
> > perf stat --bpf-counters test: Ok
> > [root@quaco ~]#
> > 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: 'perf stat --bpf-counters test' failures
  2021-11-22 13:08   ` 'perf stat --bpf-counters test' failures Arnaldo Carvalho de Melo
@ 2021-11-22 13:16     ` Jiri Olsa
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Olsa @ 2021-11-22 13:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Sohaib Mohamed, Song Liu, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Linux Kernel Mailing List

On Mon, Nov 22, 2021 at 10:08:00AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Nov 19, 2021 at 03:08:44PM +0100, Jiri Olsa escreveu:
> > On Fri, Nov 19, 2021 at 09:28:15AM -0300, Arnaldo Carvalho de Melo wrote:
> > > 
> > > After I updated to fedora 35 I started seeing the errors below,
> > > it may well not be related to that, maybe something on libbpf, haven't
> > > investigated, have you seen this?
> > 
> > yep, it seems the perf bench is broken so the counts won't correlated
> > if I revert this one:
> >   92723ea0f11d perf bench: Fix two memory leaks detected with ASan
> > 
> > it works for me again.. it seems to break -t option
> > 
> > Sohaib, could you please check on that?
> > 
> > 	[root@dell-r440-01 perf]# ./perf bench sched messaging -g 1 -l 100 -t
> > 	# Running 'sched/messaging' benchmark:
> > 	RRRperf: CLIENT: ready write: Bad file descriptor
> > 	Rperf: SENDER: write: Bad file descriptor
> 
> I'm reverting that patch, with you as the author of the revert, ok?

sure, thanks

jirka

> 
> - Arnaldo
>  
> > thanks,
> > jirka
> > 
> > > 
> > > ⬢[acme@toolbox perf]$ perf -vv
> > > perf version 5.16.rc1.gfa2b5229b222
> > >                  dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
> > >     dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
> > >                  glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
> > >          syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
> > >                 libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
> > >                 libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
> > >                libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> > > numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
> > >                libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
> > >              libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
> > >               libslang: [ on  ]  # HAVE_SLANG_SUPPORT
> > >              libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
> > >              libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
> > >     libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
> > >                   zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
> > >                   lzma: [ on  ]  # HAVE_LZMA_SUPPORT
> > >              get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
> > >                    bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
> > >                    aio: [ on  ]  # HAVE_AIO_SUPPORT
> > >                   zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
> > >                libpfm4: [ OFF ]  # HAVE_LIBPFM
> > > ⬢[acme@toolbox perf]$
> > > 
> > > This is with what I have now in my perf/urgent branch, the csets there
> > > aren't related:
> > > 
> > > ⬢[acme@toolbox perf]$ git log --oneline torvalds/master..
> > > b194c9cd09dd98af (HEAD -> perf/urgent, quaco/perf/urgent, acme/tmp.perf/urgent, acme/perf/urgent) perf evsel: Fix memory leaks relating to unit
> > > d9fc706108c15f8b perf report: Fix memory leaks around perf_tip()
> > > 0ca1f534a776cc7d perf hist: Fix memory leak of a perf_hpp_fmt
> > > 8b8dcc3720d57d88 tools headers UAPI: Sync MIPS syscall table file changed by new futex_waitv syscall
> > > e8c04ea0fef5731d tools build: Fix removal of feature-sync-compare-and-swap feature detection
> > > 9e1a8d9f683260d5 perf inject: Fix ARM SPE handling
> > > 92723ea0f11d9249 perf bench: Fix two memory leaks detected with ASan
> > > cb5a63feae2d963c perf test sample-parsing: Fix branch_stack entry endianness check
> > > 162b944598344fd7 tools headers UAPI: Sync x86's asm/kvm.h with the kernel sources
> > > db4b284029099224 perf sort: Fix the 'p_stage_cyc' sort key behavior
> > > 4d03c75363eeca86 perf sort: Fix the 'ins_lat' sort key behavior
> > > 784e8adda4cdb3e2 perf sort: Fix the 'weight' sort key behavior
> > > 70f9c9b2df1dd12c perf tools: Set COMPAT_NEED_REALLOCARRAY for CONFIG_AUXTRACE=1
> > > ccb05590c4325ce5 perf tests wp: Remove unused functions on s390
> > > 346e91998cba46b6 tools headers UAPI: Sync linux/kvm.h with the kernel sources
> > > b075c1d81e7d0e96 tools headers cpufeatures: Sync with the kernel sources
> > > ⬢[acme@toolbox perf]$
> > > 
> > > - Arnaldo
> > > 
> > > [acme@quaco perf]$ uname -a
> > > Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> > > 
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > > 92: Check Arm CoreSight trace data recording and synthesized samples: Skip
> > > 93: Check Arm SPE trace data recording and synthesized samples      : Skip
> > > 94: Check open filename arg using perf trace + vfs_getname          : Ok
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRR FAILED!
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRR FAILED!
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRRRRR Ok
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRR FAILED!
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRR Ok
> > > [root@quaco ~]# perf test 91
> > > 91: perf stat --bpf-counters test                                   :RRRRRRRRRRRRRRR Ok
> > > [root@quaco ~]# uname -a
> > > Linux quaco 5.14.17-301.fc35.x86_64 #1 SMP Mon Nov 8 13:57:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
> > > [root@quaco ~]# set -o vi
> > > [root@quaco ~]# perf test -v 91
> > > 91: perf stat --bpf-counters test                                   :
> > > --- start ---
> > > test child forked, pid 30079
> > > RRRRRRRRRRRRRRRRRThe difference between 31599305 and 36265639 are greater than 10%.
> > > test child finished with -1
> > > ---- end ----
> > > perf stat --bpf-counters test: FAILED!
> > > [root@quaco ~]# perf test -v 91
> > > 91: perf stat --bpf-counters test                                   :
> > > --- start ---
> > > test child forked, pid 30170
> > > RRRRRRRRRRRRRRRRRRRRRRRRThe difference between 33311934 and 36973889 are greater than 10%.
> > > test child finished with -1
> > > ---- end ----
> > > perf stat --bpf-counters test: FAILED!
> > > [root@quaco ~]# perf test -v 91
> > > 91: perf stat --bpf-counters test                                   :
> > > --- start ---
> > > test child forked, pid 30257
> > > RRRRRRRRRRRRRRRRRThe difference between 31420157 and 36680527 are greater than 10%.
> > > test child finished with -1
> > > ---- end ----
> > > perf stat --bpf-counters test: FAILED!
> > > [root@quaco ~]# perf test -v 91
> > > 91: perf stat --bpf-counters test                                   :
> > > --- start ---
> > > test child forked, pid 30341
> > > RRRRRRRRRRRRRRRRRRRThe difference between 32451720 and 36750342 are greater than 10%.
> > > test child finished with -1
> > > ---- end ----
> > > perf stat --bpf-counters test: FAILED!
> > > [root@quaco ~]# perf test -v 91
> > > 91: perf stat --bpf-counters test                                   :
> > > --- start ---
> > > test child forked, pid 30433
> > > RRRRRRRRRRRRRRRRRRtest child finished with 0
> > > ---- end ----
> > > perf stat --bpf-counters test: Ok
> > > [root@quaco ~]#
> > > 
> 
> -- 
> 
> - Arnaldo
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-22 13:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 12:28 'perf stat --bpf-counters test' failures Arnaldo Carvalho de Melo
2021-11-19 14:08 ` Jiri Olsa
2021-11-20  0:26   ` Namhyung Kim
2021-11-20  1:06   ` Sohaib Mohamed
2021-11-20  4:08   ` [PATCH] Fixup: perf bench: Fix two memory leaks detected with ASan Sohaib Mohamed
2021-11-20  6:53     ` Ahmad Fatoum
2021-11-20  7:08       ` Ahmad Fatoum
2021-11-22 13:08   ` 'perf stat --bpf-counters test' failures Arnaldo Carvalho de Melo
2021-11-22 13:16     ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).