Re: [PATCH] perf tools: Fix object code reading for PTI entry trampolines

From: Adrian Hunter
Date: Tue Jun 05 2018 - 10:10:21 EST


On 05/06/18 16:41, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jun 05, 2018 at 10:30:00AM +0300, Adrian Hunter escreveu:
>> Fix object code reading and the "Object code reading" test for PTI entry
>> trampolines.
>>
>> perf tools uses map__rip_2objdump() to calculate objdump virtual addresses.
>> map__rip_2objdump() needs to be amended to deal with PTI entry trampolines.
>> Also the "Object code reading" test will not create maps for the PTI entry
>> trampolines unless the machine environment exists to show that the arch is
>> x86_64.
>
> So, I split it into two patches, right at the "Also" part in your
> description:
>
> [acme@seventh perf]$ git log --oneline -2
> 36800a71b000 (HEAD -> perf/core) perf map: Consider PTI entry trampolines in rip_2objdump()
> 2f6777b74f6d perf test code-reading: Fix perf_env setup for PTI entry trampolines
> [acme@seventh perf]$
>
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
>
> And this test fails way less often, but still does, for instance:
>
> # while true ; do perf test -v object 2>out.txt ; grep -i fail out.txt && break ; done
> dso__data_read_offset failed
> Object code reading: FAILED!
> #
> [root@seventh ~]# tail out.txt
> File is: /proc/kcore
> On file address is: 0x7fff892300df
> kcore map tested already - skipping
> Reading object code for memory address: 0x4a020f
> File is: /home/acme/bin/perf (deleted)
> On file address is: 0xa020f
> dso__data_read_offset failed
> test child finished with -1
> ---- end ----
> Object code reading: FAILED!
> [root@seventh ~]#
>
> I start that loop and then try running 'make -C tools/perf O=/tmp/build/perf install-bin',
> to generate some load.

So is it related to the "deleted" in "File is: /home/acme/bin/perf (deleted)"?

>
> But now at least on a quiet system it works.
>
> - Arnaldo
>