Re: perf test 'instruction decoder' failing

From: Arnaldo Carvalho de Melo
Date: Wed Mar 01 2017 - 09:50:39 EST


Em Tue, Feb 28, 2017 at 12:02:36PM +0200, Adrian Hunter escreveu:
> On 24/02/17 22:27, Arnaldo Carvalho de Melo wrote:
> > Hi Adrian,
> >
> > This test is failing, I'll try to recheck this and bisect it,
> > but since I haven't had the time so far and I saw it since yesterday (at
> > least), lemme document it here:
> >
> >
> > [root@jouet ~]# perf test -v 57
> > 57: x86 instruction decoder - new instructions :
> > --- start ---
> > test child forked, pid 18975
> > Decoded ok: 0f 31 rdtsc
> > Decoded ok: 0f 1b 80 78 56 34 12 bndstx %bnd0,0x12345678(%eax)
> > <SNIP tons of OKays>
> > Decoded ok: 0f 1b 85 78 56 34 12 bndstx %bnd0,0x12345678(%ebp)
> > Decoded ok: 0f 1b 84 01 78 56 34 12 bndstx %bnd0,0x12345678(%ecx,%eax,1)
> > Decoded ok: 0f 1b 84 05 78 56 34 12 bndstx %bnd0,0x12345678(%ebp,%eax,1)
> > Decoded ok: 0f 1b 84 08 78 56 34 12 bndstx %bnd0,0x12345678(%eax,%ecx,1)
> > Decoded ok: f2 e8 fc ff ff ff bnd call fce <main+0xfce>
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): f2 ff 10 bnd call *(%eax)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): f2 c3 bnd ret
> > Decoded ok: f2 e9 fc ff ff ff bnd jmp fd9 <main+0xfd9>
> > Decoded ok: f2 e9 fc ff ff ff bnd jmp fdf <main+0xfdf>
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): f2 ff 21 bnd jmp *(%ecx)
> > Decoded ok: f2 0f 85 fc ff ff ff bnd jne fe9 <main+0xfe9>
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc c1 00 sha1rnds4 $0x0,%xmm1,%xmm0
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc d7 91 sha1rnds4 $0x91,%xmm7,%xmm2
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 00 91 sha1rnds4 $0x91,(%eax),%xmm0
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 05 78 56 34 12 91 sha1rnds4 $0x91,0x12345678,%xmm0
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 18 91 sha1rnds4 $0x91,(%eax),%xmm3
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 04 01 91 sha1rnds4 $0x91,(%ecx,%eax,1),%xmm0
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 04 05 78 56 34 12 91 sha1rnds4 $0x91,0x12345678(,%eax,1),%xmm0
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 04 08 91 sha1rnds4 $0x91,(%eax,%ecx,1),%xmm0
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 3a cc 04 c8 91 sha1rnds4 $0x91,(%eax,%ecx,8),%xmm0
> > <SNIP lots of fails>
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 45 12 bndstx %bnd0,0x12(%rbp)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 44 01 12 bndstx %bnd0,0x12(%rcx,%rax,1)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 44 05 12 bndstx %bnd0,0x12(%rbp,%rax,1)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 44 08 12 bndstx %bnd0,0x12(%rax,%rcx,1)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 80 78 56 34 12 bndstx %bnd0,0x12345678(%rax)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 85 78 56 34 12 bndstx %bnd0,0x12345678(%rbp)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 84 01 78 56 34 12 bndstx %bnd0,0x12345678(%rcx,%rax,1)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 84 05 78 56 34 12 bndstx %bnd0,0x12345678(%rbp,%rax,1)
> > Failed to decode 'rel' value (0xfffffffc vs expected 0): 0f 1b 84 08 78 56 34 12 bndstx %bnd0,0x12345678(%rax,%rcx,1)
> > Decoded ok: f2 e8 00 00 00 00 bnd callq f22 <main+0xf22>
> > Decoded ok: 67 f2 ff 10 bnd callq *(%eax)
> > <SNIP lots of OKays>
> > Decoded ok: 41 0f c7 9c c8 78 56 34 12 xrstors 0x12345678(%r8,%rcx,8)
> > Decoded ok: 0f 01 ee rdpkru
> > Decoded ok: 0f 01 ef wrpkru
> > test child finished with -1
> > ---- end ----
> > x86 instruction decoder - new instructions: FAILED!
> >
> > Fedora 25,
> >
> > [acme@jouet linux]$ uname -a
> > Linux jouet 4.10.0-rc8 #2 SMP Wed Feb 15 15:26:36 BRT 2017 x86_64 x86_64 x86_64 GNU/Linux
> >
> > [acme@jouet linux]$ rpm -q binutils elfutils gcc glibc
> > binutils-2.26.1-1.fc25.x86_64
> > elfutils-0.168-1.fc25.x86_64
> > gcc-6.3.1-1.fc25.x86_64
> > glibc-2.24-4.fc25.x86_64
> > glibc-2.24-4.fc25.i686
> > [acme@jouet linux]$
> >
> > [acme@jouet linux]$ perf -v
> > perf version 4.10.g264b77
> >
> > perf as in tip/perf/core and soon as in acme/perf/core
>
> There is missing initialization. It only affects the test because it is checking 'rel' even in cases where there is no value.
>
> Here is the fix.

Thanks, I'll test it, I assume I can add your Signed-off-by: tag to this
cset, ok? The comment I can just use your missing init comment above,

Thanks,

- Arnaldo

>
> diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
> index 7913363bde5c..55b6250350d7 100644
> --- a/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
> +++ b/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
> @@ -39,6 +39,8 @@ static void intel_pt_insn_decoder(struct insn *insn,
> enum intel_pt_insn_branch branch = INTEL_PT_BR_NO_BRANCH;
> int ext;
>
> + intel_pt_insn->rel = 0;
> +
> if (insn_is_avx(insn)) {
> intel_pt_insn->op = INTEL_PT_OP_OTHER;
> intel_pt_insn->branch = INTEL_PT_BR_NO_BRANCH;
>
>