Re: [PATCH 6/6] perf thread-stack: Hide x86 retpolines

Arnaldo Carvalho de Melo
2019-02-22T20:53:47Z

Em Fri, Feb 22, 2019 at 04:42:44PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jan 09, 2019 at 11:18:35AM +0200, Adrian Hunter escreveu:
> > +static int thread_stack__x86_retpoline(struct thread_stack *ts,
> > + struct perf_sample *sample,
> > + struct addr_location *to_al)
> > +{
> > + struct thread_stack_entry *tse = &ts->stack[ts->cnt - 1];
> > + struct call_path_root *cpr = ts->crp->cpr;
> > + struct symbol *sym = tse->cp->sym;
> > + struct symbol *tsym = to_al->sym;
> > + struct call_path *cp;
> > +
> > + if (sym && sym->name && is_x86_retpoline(sym->name)) {
>
>
> CC /tmp/build/perf/util/scripting-engines/trace-event-perl.o
> CC /tmp/build/perf/util/intel-pt.o
> CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-log.o
> util/thread-stack.c:780:18: error: address of array 'sym->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
> if (sym && sym->name && is_x86_retpoline(sym->name)) {
> ~~ ~~~~~^~~~
> 1 error generated.
> mv: cannot stat '/tmp/build/perf/util/.thread-stack.o.tmp': No such file or directory
> make[4]: *** [/git/linux/tools/build/Makefile.build:96: /tmp/build/perf/util/thread-stack.o] Error 1
>
>
> [acme@quaco perf]$ pahole -C symbol ~/bin/perf
> struct symbol {
> struct rb_node rb_node; /* 0 24 */
> u64 start; /* 24 8 */
> u64 end; /* 32 8 */
> u16 namelen; /* 40 2 */
> u8 type:4; /* 42: 4 1 */
> u8 binding:4; /* 42: 0 1 */
> u8 idle:1; /* 43: 7 1 */
> u8 ignore:1; /* 43: 6 1 */
> u8 inlined:1; /* 43: 5 1 */
>
> /* XXX 5 bits hole, try to pack */
>
> u8 arch_sym; /* 44 1 */
> _Bool annotate2; /* 45 1 */
> char name[0]; /* 46 0 */
>
> /* size: 48, cachelines: 1, members: 12 */
> /* bit holes: 1, sum bit holes: 5 bits */
> /* padding: 2 */
> /* last cacheline: 48 bytes */
> };
> [acme@quaco perf]$
>
> I'm removing that sym->name test.

For completeness sake, this was one of the compilers where this failed:

clang version 7.0.1 (Fedora 7.0.1-2.fc30)

The systems where it broke:

18 debian:9 : FAIL
19 debian:experimental : FAIL
29 fedora:25 : FAIL
30 fedora:26 : FAIL
31 fedora:27 : FAIL
32 fedora:28 : FAIL
33 fedora:29 : FAIL
34 fedora:30 : FAIL
35 fedora:rawhide : FAIL
45 opensuse:tumbleweed : FAIL
51 ubuntu:16.04 : FAIL
58 ubuntu:17.10 : FAIL
59 ubuntu:18.04 : FAIL
70 ubuntu:18.10 : FAIL
71 ubuntu:19.04 : FAIL

- Arnaldo