Subject: Re: [PATCH v2] perf: libdw support for powerpc [ping]

From: Mark Wielaard <[email-masked]>
Date: Tue, 13 Jun 2017 13:44:42 +0200

Hi Ravi,

On Mon, 2017-06-12 at 17:28 +0530, Ravi Bangoria wrote:
> So, I tested this patch along with Mark's patch[1] on elfutils an looks
> like it's not working. Steps on what I did:
> 
> After applying Mark's patch on upstream elfutils:
> 
>   $ aclocal
>   $ autoheader
>   $ autoconf
>   $ automake --add-missing
>   $ ./configure
>   $ make
>   $ make install DESTDIR=/home/ravi/elfutils-git
> 
> After applying your patch on upstream perf:
> 
>   $ make
>   $ ./perf record --call-graph=dwarf ls
>   $ LD_LIBRARY_PATH=/home/ravi/elfutils-git/usr/local/lib:\
>     /home/ravi/elfutils-git/usr/local/lib/elfutils/:$LD_LIBRARY_PATH \
>     ./perf script
> 
>     ls 44159  1800.878468:     191408 cycles:u:
> 
>     ls 44159  1800.878673:     419356 cycles:u:
>                        8a97c hpte_need_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                        835f4 flush_hash_page (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                        8acec hpte_need_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                       3468f4 ptep_clear_flush (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                       328b10 wp_page_copy (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                       32ebe4 do_wp_page (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                       33434c __handle_mm_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                       335040 handle_mm_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                        7bf94 do_page_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
>                        1a4f8 handle_page_fault (/usr/lib/debug/lib/modules/4.11.0-3.el7.ppc64le/vmlinux)
> 
>     ls 44159  1800.878961:     430876 cycles:u:
> 
>     ls 44159  1800.879195:     423785 cycles:u:
> 
>     ls 44159  1800.879360:     427359 cycles:u:
> 
> Here I don't see userspace callchain getting unwound. Please let me know
> if I'm doing anything wrong.

I see the same on very short runs. But when doing a slightly longer run,
even just using ls -lahR, which does some more work, then I do see user
backtraces. They are still missing for some of the early samples though.
It is as if there is a stack/memory address mismatch when the probe is
"too early" in ld.so.

Could you do a test run on some program that does some more work to see
if you never get any user stack traces, or if you only not get them for
some specific probes?

Thanks,

Mark