Re: [PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-06-22 Thread Adrian Hunter
On 19/06/15 18:44, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jun 18, 2015 at 07:29:41PM -0300, Arnaldo Carvalho de Melo escreveu:
>> Em Fri, May 29, 2015 at 04:33:33PM +0300, Adrian Hunter escreveu:
>>> Add support for decoding instructions for Intel Processor Trace.  The
>>> kernel x86 instruction decoder is used for this.
>>
>> Ok, but we don't access kernel header files directly, and:
>>
>> [acme@zoo linux]$ find . -name "insn.h"
>> ./arch/x86/include/asm/insn.h
>> ./arch/arm64/include/asm/insn.h
>> ./arch/arm/include/asm/insn.h
>> [acme@zoo linux]$ find /usr/include -name "insn.h"
>> [acme@zoo linux]$ 
>>
>> But I need to look more into this patch to figure out if this is
>> something generated at build time, etc, but before that I found a
>> problem:
>>
>> So:
>>
>>> +inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
>>> +inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt
>>
>> These need to go into tools/perf/MANIFEST, so that:
> 
> So, after adding:
> 
> diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
> index fe50a1b34aa0..4e5662d8c274 100644
> --- a/tools/perf/MANIFEST
> +++ b/tools/perf/MANIFEST
> @@ -58,6 +58,13 @@ include/linux/stringify.h
>  lib/hweight.c
>  lib/rbtree.c
>  include/linux/swab.h
> +arch/x86/lib/insn.c
> +arch/x86/lib/inat.c
> +arch/x86/include/asm/insn.h
> +arch/x86/include/asm/inat.h
> +arch/x86/include/asm/inat_types.h
> +arch/x86/tools/gen-insn-attr-x86.awk
> +arch/x86/lib/x86-opcode-map.txt
>  arch/*/include/asm/unistd*.h
>  arch/*/include/uapi/asm/unistd*.h
>  arch/*/include/uapi/asm/perf_regs.h
> 
> The test passes:
> 
> [acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg && echo Ok
> make: Entering directory '/home/git/linux/tools/perf'
> - tarpkg: ./tests/perf-targz-src-pkg .
> make: Leaving directory '/home/git/linux/tools/perf'
> Ok
> [acme@zoo linux]$
> 
> Merging these changes with this changeset to continue testing...

Thank you! :-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-06-22 Thread Adrian Hunter
On 19/06/15 18:44, Arnaldo Carvalho de Melo wrote:
 Em Thu, Jun 18, 2015 at 07:29:41PM -0300, Arnaldo Carvalho de Melo escreveu:
 Em Fri, May 29, 2015 at 04:33:33PM +0300, Adrian Hunter escreveu:
 Add support for decoding instructions for Intel Processor Trace.  The
 kernel x86 instruction decoder is used for this.

 Ok, but we don't access kernel header files directly, and:

 [acme@zoo linux]$ find . -name insn.h
 ./arch/x86/include/asm/insn.h
 ./arch/arm64/include/asm/insn.h
 ./arch/arm/include/asm/insn.h
 [acme@zoo linux]$ find /usr/include -name insn.h
 [acme@zoo linux]$ 

 But I need to look more into this patch to figure out if this is
 something generated at build time, etc, but before that I found a
 problem:

 So:

 +inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
 +inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt

 These need to go into tools/perf/MANIFEST, so that:
 
 So, after adding:
 
 diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
 index fe50a1b34aa0..4e5662d8c274 100644
 --- a/tools/perf/MANIFEST
 +++ b/tools/perf/MANIFEST
 @@ -58,6 +58,13 @@ include/linux/stringify.h
  lib/hweight.c
  lib/rbtree.c
  include/linux/swab.h
 +arch/x86/lib/insn.c
 +arch/x86/lib/inat.c
 +arch/x86/include/asm/insn.h
 +arch/x86/include/asm/inat.h
 +arch/x86/include/asm/inat_types.h
 +arch/x86/tools/gen-insn-attr-x86.awk
 +arch/x86/lib/x86-opcode-map.txt
  arch/*/include/asm/unistd*.h
  arch/*/include/uapi/asm/unistd*.h
  arch/*/include/uapi/asm/perf_regs.h
 
 The test passes:
 
 [acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg  echo Ok
 make: Entering directory '/home/git/linux/tools/perf'
 - tarpkg: ./tests/perf-targz-src-pkg .
 make: Leaving directory '/home/git/linux/tools/perf'
 Ok
 [acme@zoo linux]$
 
 Merging these changes with this changeset to continue testing...

Thank you! :-)

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-06-19 Thread Arnaldo Carvalho de Melo
Em Thu, Jun 18, 2015 at 07:29:41PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, May 29, 2015 at 04:33:33PM +0300, Adrian Hunter escreveu:
> > Add support for decoding instructions for Intel Processor Trace.  The
> > kernel x86 instruction decoder is used for this.
> 
> Ok, but we don't access kernel header files directly, and:
> 
> [acme@zoo linux]$ find . -name "insn.h"
> ./arch/x86/include/asm/insn.h
> ./arch/arm64/include/asm/insn.h
> ./arch/arm/include/asm/insn.h
> [acme@zoo linux]$ find /usr/include -name "insn.h"
> [acme@zoo linux]$ 
> 
> But I need to look more into this patch to figure out if this is
> something generated at build time, etc, but before that I found a
> problem:
> 
> So:
> 
> > +inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
> > +inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt
> 
> These need to go into tools/perf/MANIFEST, so that:

So, after adding:

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index fe50a1b34aa0..4e5662d8c274 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -58,6 +58,13 @@ include/linux/stringify.h
 lib/hweight.c
 lib/rbtree.c
 include/linux/swab.h
+arch/x86/lib/insn.c
+arch/x86/lib/inat.c
+arch/x86/include/asm/insn.h
+arch/x86/include/asm/inat.h
+arch/x86/include/asm/inat_types.h
+arch/x86/tools/gen-insn-attr-x86.awk
+arch/x86/lib/x86-opcode-map.txt
 arch/*/include/asm/unistd*.h
 arch/*/include/uapi/asm/unistd*.h
 arch/*/include/uapi/asm/perf_regs.h

The test passes:

[acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg && echo Ok
make: Entering directory '/home/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make: Leaving directory '/home/git/linux/tools/perf'
Ok
[acme@zoo linux]$

Merging these changes with this changeset to continue testing...

Also force pushing it to the tmp.perf/pt branch.

- Arnaldo
 
> [acme@zoo linux]$ make help | grep perf
>   perf-tar-src-pkg- Build perf-4.1.0-rc5.tar source tarball
>   perf-targz-src-pkg  - Build perf-4.1.0-rc5.tar.gz source tarball
>   perf-tarbz2-src-pkg - Build perf-4.1.0-rc5.tar.bz2 source tarball
>   perf-tarxz-src-pkg  - Build perf-4.1.0-rc5.tar.xz source tarball
> [acme@zoo linux]$ 
> 
> Continue to work, in fact, there is a test for that, that will run
> when you do the build tests:
> 
> make -C tools/perf build-test
> 
> It is one of the last to be tested, so you may want to do it directly:
> 
> [acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
> make: Entering directory '/home/git/linux/tools/perf'
> - tarpkg: ./tests/perf-targz-src-pkg .
> make: Leaving directory '/home/git/linux/tools/perf'
> [acme@zoo linux]$
> 
> After I apply this patch, I get:
> 
> Applying: perf tools: Add Intel PT instruction decoder
> [tmp.perf/pt 1ab14c4be64b] perf tools: Add Intel PT instruction decoder
>  Author: Adrian Hunter 
>  Date: Fri May 29 16:33:33 2015 +0300
>  6 files changed, 339 insertions(+), 3 deletions(-)
>  rewrite tools/perf/util/intel-pt-decoder/Build (100%)
>  create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
>  create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
> [acme@zoo linux]$ fg
> bash: fg: current: no such job
> [acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
> make: Entering directory '/home/git/linux/tools/perf'
> - tarpkg: ./tests/perf-targz-src-pkg .
> tests/make:224: recipe for target 'tarpkg' failed
> make: *** [tarpkg] Error 2
> make: Leaving directory '/home/git/linux/tools/perf'
> [acme@zoo linux]$ 
> 
> Doing it manually to see what happened:
> 
> [acme@zoo linux]$ make perf-tar-src-pkg
>   TAR
> [acme@zoo linux]$ ls -la perf-4.1.0-rc5.tar 
> -rw-rw-r--. 1 acme acme 5027840 Jun 18 19:24 perf-4.1.0-rc5.tar
> [acme@zoo linux]$ mv perf-4.1.0-rc5.tar /tmp
> [acme@zoo linux]$ cd /tmp
> [acme@zoo tmp]$ tar xf perf-4.1.0-rc5.tar 
> [acme@zoo tmp]$ cd perf-4.1.0-rc5/
> [acme@zoo perf-4.1.0-rc5]$ make -C tools/perf
> make: Entering directory '/tmp/perf-4.1.0-rc5/tools/perf'
>   BUILD:   Doing 'make -j4' parallel build
> 
> Auto-detecting system features:
> ... dwarf: [ on  ]
> ... glibc: [ on  ]
> ...  gtk2: [ on  ]
> ...  libaudit: [ on  ]
> ...libbfd: [ on  ]
> ...libelf: [ on  ]
> ...   libnuma: [ on  ]
> ...   libperl: [ on  ]
> ... libpython: [ on  ]
> ...  libslang: [ on  ]
> ... libunwind: [ on  ]
> ...libdw-dwarf-unwind: [ on  ]
> ...  zlib: [ on  ]
> ...  lzma: [ on  ]
> 
>   CC   util/abspath.o
>   CC   fd/array.o
>   PERF_VERSION = 4.1.rc5.g1ab14c
>   CC   fs/fs.o
>   CC   event-parse.o
>   LD   fd/libapi-in.o
>   CC   event-plugin.o
>   CC   fs/debugfs.o
>   CC   util/alias.o
>   CC   trace-seq.o
> 
>   CC   

Re: [PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-06-19 Thread Arnaldo Carvalho de Melo
Em Thu, Jun 18, 2015 at 07:29:41PM -0300, Arnaldo Carvalho de Melo escreveu:
 Em Fri, May 29, 2015 at 04:33:33PM +0300, Adrian Hunter escreveu:
  Add support for decoding instructions for Intel Processor Trace.  The
  kernel x86 instruction decoder is used for this.
 
 Ok, but we don't access kernel header files directly, and:
 
 [acme@zoo linux]$ find . -name insn.h
 ./arch/x86/include/asm/insn.h
 ./arch/arm64/include/asm/insn.h
 ./arch/arm/include/asm/insn.h
 [acme@zoo linux]$ find /usr/include -name insn.h
 [acme@zoo linux]$ 
 
 But I need to look more into this patch to figure out if this is
 something generated at build time, etc, but before that I found a
 problem:
 
 So:
 
  +inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
  +inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt
 
 These need to go into tools/perf/MANIFEST, so that:

So, after adding:

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index fe50a1b34aa0..4e5662d8c274 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -58,6 +58,13 @@ include/linux/stringify.h
 lib/hweight.c
 lib/rbtree.c
 include/linux/swab.h
+arch/x86/lib/insn.c
+arch/x86/lib/inat.c
+arch/x86/include/asm/insn.h
+arch/x86/include/asm/inat.h
+arch/x86/include/asm/inat_types.h
+arch/x86/tools/gen-insn-attr-x86.awk
+arch/x86/lib/x86-opcode-map.txt
 arch/*/include/asm/unistd*.h
 arch/*/include/uapi/asm/unistd*.h
 arch/*/include/uapi/asm/perf_regs.h

The test passes:

[acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg  echo Ok
make: Entering directory '/home/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make: Leaving directory '/home/git/linux/tools/perf'
Ok
[acme@zoo linux]$

Merging these changes with this changeset to continue testing...

Also force pushing it to the tmp.perf/pt branch.

- Arnaldo
 
 [acme@zoo linux]$ make help | grep perf
   perf-tar-src-pkg- Build perf-4.1.0-rc5.tar source tarball
   perf-targz-src-pkg  - Build perf-4.1.0-rc5.tar.gz source tarball
   perf-tarbz2-src-pkg - Build perf-4.1.0-rc5.tar.bz2 source tarball
   perf-tarxz-src-pkg  - Build perf-4.1.0-rc5.tar.xz source tarball
 [acme@zoo linux]$ 
 
 Continue to work, in fact, there is a test for that, that will run
 when you do the build tests:
 
 make -C tools/perf build-test
 
 It is one of the last to be tested, so you may want to do it directly:
 
 [acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
 make: Entering directory '/home/git/linux/tools/perf'
 - tarpkg: ./tests/perf-targz-src-pkg .
 make: Leaving directory '/home/git/linux/tools/perf'
 [acme@zoo linux]$
 
 After I apply this patch, I get:
 
 Applying: perf tools: Add Intel PT instruction decoder
 [tmp.perf/pt 1ab14c4be64b] perf tools: Add Intel PT instruction decoder
  Author: Adrian Hunter adrian.hun...@intel.com
  Date: Fri May 29 16:33:33 2015 +0300
  6 files changed, 339 insertions(+), 3 deletions(-)
  rewrite tools/perf/util/intel-pt-decoder/Build (100%)
  create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
  create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
 [acme@zoo linux]$ fg
 bash: fg: current: no such job
 [acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
 make: Entering directory '/home/git/linux/tools/perf'
 - tarpkg: ./tests/perf-targz-src-pkg .
 tests/make:224: recipe for target 'tarpkg' failed
 make: *** [tarpkg] Error 2
 make: Leaving directory '/home/git/linux/tools/perf'
 [acme@zoo linux]$ 
 
 Doing it manually to see what happened:
 
 [acme@zoo linux]$ make perf-tar-src-pkg
   TAR
 [acme@zoo linux]$ ls -la perf-4.1.0-rc5.tar 
 -rw-rw-r--. 1 acme acme 5027840 Jun 18 19:24 perf-4.1.0-rc5.tar
 [acme@zoo linux]$ mv perf-4.1.0-rc5.tar /tmp
 [acme@zoo linux]$ cd /tmp
 [acme@zoo tmp]$ tar xf perf-4.1.0-rc5.tar 
 [acme@zoo tmp]$ cd perf-4.1.0-rc5/
 [acme@zoo perf-4.1.0-rc5]$ make -C tools/perf
 make: Entering directory '/tmp/perf-4.1.0-rc5/tools/perf'
   BUILD:   Doing 'make -j4' parallel build
 
 Auto-detecting system features:
 ... dwarf: [ on  ]
 ... glibc: [ on  ]
 ...  gtk2: [ on  ]
 ...  libaudit: [ on  ]
 ...libbfd: [ on  ]
 ...libelf: [ on  ]
 ...   libnuma: [ on  ]
 ...   libperl: [ on  ]
 ... libpython: [ on  ]
 ...  libslang: [ on  ]
 ... libunwind: [ on  ]
 ...libdw-dwarf-unwind: [ on  ]
 ...  zlib: [ on  ]
 ...  lzma: [ on  ]
 
   CC   util/abspath.o
   CC   fd/array.o
   PERF_VERSION = 4.1.rc5.g1ab14c
   CC   fs/fs.o
   CC   event-parse.o
   LD   fd/libapi-in.o
   CC   event-plugin.o
   CC   fs/debugfs.o
   CC   util/alias.o
   CC   trace-seq.o
 SNIP
   CC   util/cloexec.o
   CC   util/thread-stack.o
   CC   builtin-kmem.o
   CC   

Re: [PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-06-18 Thread Arnaldo Carvalho de Melo
Em Fri, May 29, 2015 at 04:33:33PM +0300, Adrian Hunter escreveu:
> Add support for decoding instructions for Intel Processor Trace.  The
> kernel x86 instruction decoder is used for this.

Ok, but we don't access kernel header files directly, and:

[acme@zoo linux]$ find . -name "insn.h"
./arch/x86/include/asm/insn.h
./arch/arm64/include/asm/insn.h
./arch/arm/include/asm/insn.h
[acme@zoo linux]$ find /usr/include -name "insn.h"
[acme@zoo linux]$ 

But I need to look more into this patch to figure out if this is
something generated at build time, etc, but before that I found a
problem:

So:

> +inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
> +inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt

These need to go into tools/perf/MANIFEST, so that:

[acme@zoo linux]$ make help | grep perf
  perf-tar-src-pkg- Build perf-4.1.0-rc5.tar source tarball
  perf-targz-src-pkg  - Build perf-4.1.0-rc5.tar.gz source tarball
  perf-tarbz2-src-pkg - Build perf-4.1.0-rc5.tar.bz2 source tarball
  perf-tarxz-src-pkg  - Build perf-4.1.0-rc5.tar.xz source tarball
[acme@zoo linux]$ 

Continue to work, in fact, there is a test for that, that will run
when you do the build tests:

make -C tools/perf build-test

It is one of the last to be tested, so you may want to do it directly:

[acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
make: Entering directory '/home/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make: Leaving directory '/home/git/linux/tools/perf'
[acme@zoo linux]$

After I apply this patch, I get:

Applying: perf tools: Add Intel PT instruction decoder
[tmp.perf/pt 1ab14c4be64b] perf tools: Add Intel PT instruction decoder
 Author: Adrian Hunter 
 Date: Fri May 29 16:33:33 2015 +0300
 6 files changed, 339 insertions(+), 3 deletions(-)
 rewrite tools/perf/util/intel-pt-decoder/Build (100%)
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
[acme@zoo linux]$ fg
bash: fg: current: no such job
[acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
make: Entering directory '/home/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
tests/make:224: recipe for target 'tarpkg' failed
make: *** [tarpkg] Error 2
make: Leaving directory '/home/git/linux/tools/perf'
[acme@zoo linux]$ 

Doing it manually to see what happened:

[acme@zoo linux]$ make perf-tar-src-pkg
  TAR
[acme@zoo linux]$ ls -la perf-4.1.0-rc5.tar 
-rw-rw-r--. 1 acme acme 5027840 Jun 18 19:24 perf-4.1.0-rc5.tar
[acme@zoo linux]$ mv perf-4.1.0-rc5.tar /tmp
[acme@zoo linux]$ cd /tmp
[acme@zoo tmp]$ tar xf perf-4.1.0-rc5.tar 
[acme@zoo tmp]$ cd perf-4.1.0-rc5/
[acme@zoo perf-4.1.0-rc5]$ make -C tools/perf
make: Entering directory '/tmp/perf-4.1.0-rc5/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]

  CC   util/abspath.o
  CC   fd/array.o
  PERF_VERSION = 4.1.rc5.g1ab14c
  CC   fs/fs.o
  CC   event-parse.o
  LD   fd/libapi-in.o
  CC   event-plugin.o
  CC   fs/debugfs.o
  CC   util/alias.o
  CC   trace-seq.o

  CC   util/cloexec.o
  CC   util/thread-stack.o
  CC   builtin-kmem.o
  CC   builtin-lock.o
  CC   util/auxtrace.o
  CC   util/intel-pt-decoder/intel-pt-pkt-decoder.o
make[4]: *** No rule to make target 
'../../arch/x86/tools/gen-insn-attr-x86.awk', needed by 
'util/intel-pt-decoder/inat-tables.c'.  Stop.
make[4]: *** Waiting for unfinished jobs
  GEN  util/intel-pt-decoder/inat.c
cp: cannot stat ā€˜../../arch/x86/lib/inat.cā€™: No such file or directory
util/intel-pt-decoder/Build:10: recipe for target 
'util/intel-pt-decoder/inat.c' failed
make[4]: *** [util/intel-pt-decoder/inat.c] Error 1
/tmp/perf-4.1.0-rc5/tools/build/Makefile.build:109: recipe for target 
'intel-pt-decoder' failed
make[3]: *** [intel-pt-decoder] Error 2
make[3]: *** Waiting for unfinished jobs
  CC   builtin-kvm.o
  CC   builtin-inject.o
/tmp/perf-4.1.0-rc5/tools/build/Makefile.build:109: recipe for target 'util' 
failed
make[2]: *** [util] Error 2
Makefile.perf:380: recipe for target 'libperf-in.o' failed
make[1]: *** [libperf-in.o] Error 2
make[1]: *** Waiting for unfinished jobs
  CC   builtin-mem.o
  CC   builtin-data.o
  CC   builtin-trace.o

  LD   tests/perf-in.o
  LD   perf-in.o

Re: [PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-06-18 Thread Arnaldo Carvalho de Melo
Em Fri, May 29, 2015 at 04:33:33PM +0300, Adrian Hunter escreveu:
 Add support for decoding instructions for Intel Processor Trace.  The
 kernel x86 instruction decoder is used for this.

Ok, but we don't access kernel header files directly, and:

[acme@zoo linux]$ find . -name insn.h
./arch/x86/include/asm/insn.h
./arch/arm64/include/asm/insn.h
./arch/arm/include/asm/insn.h
[acme@zoo linux]$ find /usr/include -name insn.h
[acme@zoo linux]$ 

But I need to look more into this patch to figure out if this is
something generated at build time, etc, but before that I found a
problem:

So:

 +inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
 +inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt

These need to go into tools/perf/MANIFEST, so that:

[acme@zoo linux]$ make help | grep perf
  perf-tar-src-pkg- Build perf-4.1.0-rc5.tar source tarball
  perf-targz-src-pkg  - Build perf-4.1.0-rc5.tar.gz source tarball
  perf-tarbz2-src-pkg - Build perf-4.1.0-rc5.tar.bz2 source tarball
  perf-tarxz-src-pkg  - Build perf-4.1.0-rc5.tar.xz source tarball
[acme@zoo linux]$ 

Continue to work, in fact, there is a test for that, that will run
when you do the build tests:

make -C tools/perf build-test

It is one of the last to be tested, so you may want to do it directly:

[acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
make: Entering directory '/home/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make: Leaving directory '/home/git/linux/tools/perf'
[acme@zoo linux]$

After I apply this patch, I get:

Applying: perf tools: Add Intel PT instruction decoder
[tmp.perf/pt 1ab14c4be64b] perf tools: Add Intel PT instruction decoder
 Author: Adrian Hunter adrian.hun...@intel.com
 Date: Fri May 29 16:33:33 2015 +0300
 6 files changed, 339 insertions(+), 3 deletions(-)
 rewrite tools/perf/util/intel-pt-decoder/Build (100%)
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h
[acme@zoo linux]$ fg
bash: fg: current: no such job
[acme@zoo linux]$ make -C tools/perf -f tests/make tarpkg
make: Entering directory '/home/git/linux/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
tests/make:224: recipe for target 'tarpkg' failed
make: *** [tarpkg] Error 2
make: Leaving directory '/home/git/linux/tools/perf'
[acme@zoo linux]$ 

Doing it manually to see what happened:

[acme@zoo linux]$ make perf-tar-src-pkg
  TAR
[acme@zoo linux]$ ls -la perf-4.1.0-rc5.tar 
-rw-rw-r--. 1 acme acme 5027840 Jun 18 19:24 perf-4.1.0-rc5.tar
[acme@zoo linux]$ mv perf-4.1.0-rc5.tar /tmp
[acme@zoo linux]$ cd /tmp
[acme@zoo tmp]$ tar xf perf-4.1.0-rc5.tar 
[acme@zoo tmp]$ cd perf-4.1.0-rc5/
[acme@zoo perf-4.1.0-rc5]$ make -C tools/perf
make: Entering directory '/tmp/perf-4.1.0-rc5/tools/perf'
  BUILD:   Doing 'make -j4' parallel build

Auto-detecting system features:
... dwarf: [ on  ]
... glibc: [ on  ]
...  gtk2: [ on  ]
...  libaudit: [ on  ]
...libbfd: [ on  ]
...libelf: [ on  ]
...   libnuma: [ on  ]
...   libperl: [ on  ]
... libpython: [ on  ]
...  libslang: [ on  ]
... libunwind: [ on  ]
...libdw-dwarf-unwind: [ on  ]
...  zlib: [ on  ]
...  lzma: [ on  ]

  CC   util/abspath.o
  CC   fd/array.o
  PERF_VERSION = 4.1.rc5.g1ab14c
  CC   fs/fs.o
  CC   event-parse.o
  LD   fd/libapi-in.o
  CC   event-plugin.o
  CC   fs/debugfs.o
  CC   util/alias.o
  CC   trace-seq.o
SNIP
  CC   util/cloexec.o
  CC   util/thread-stack.o
  CC   builtin-kmem.o
  CC   builtin-lock.o
  CC   util/auxtrace.o
  CC   util/intel-pt-decoder/intel-pt-pkt-decoder.o
make[4]: *** No rule to make target 
'../../arch/x86/tools/gen-insn-attr-x86.awk', needed by 
'util/intel-pt-decoder/inat-tables.c'.  Stop.
make[4]: *** Waiting for unfinished jobs
  GEN  util/intel-pt-decoder/inat.c
cp: cannot stat ā€˜../../arch/x86/lib/inat.cā€™: No such file or directory
util/intel-pt-decoder/Build:10: recipe for target 
'util/intel-pt-decoder/inat.c' failed
make[4]: *** [util/intel-pt-decoder/inat.c] Error 1
/tmp/perf-4.1.0-rc5/tools/build/Makefile.build:109: recipe for target 
'intel-pt-decoder' failed
make[3]: *** [intel-pt-decoder] Error 2
make[3]: *** Waiting for unfinished jobs
  CC   builtin-kvm.o
  CC   builtin-inject.o
/tmp/perf-4.1.0-rc5/tools/build/Makefile.build:109: recipe for target 'util' 
failed
make[2]: *** [util] Error 2
Makefile.perf:380: recipe for target 'libperf-in.o' failed
make[1]: *** [libperf-in.o] Error 2
make[1]: *** Waiting for unfinished jobs
  CC   builtin-mem.o
  CC   builtin-data.o
  CC   builtin-trace.o
SNIP
  LD   tests/perf-in.o
  LD  

[PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-05-29 Thread Adrian Hunter
Add support for decoding instructions for Intel Processor Trace.  The
kernel x86 instruction decoder is used for this.

This essentially provides intel_pt_get_insn() which takes a binary
buffer, uses the kernel's x86 instruction decoder to get details
of the instruction and then categorizes it for consumption by
an Intel PT decoder.

Signed-off-by: Adrian Hunter 
---
 tools/build/Makefile.build |   2 +
 tools/perf/.gitignore  |   2 +
 tools/perf/Makefile.perf   |  12 +-
 tools/perf/util/intel-pt-decoder/Build |  15 +-
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  | 246 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |  65 ++
 6 files changed, 339 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h

diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 10df572..7ad74e4 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -57,6 +57,8 @@ quiet_cmd_cc_i_c = CPP  $@
 quiet_cmd_cc_s_c = AS   $@
   cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
 
+quiet_cmd_gen = GEN  $@
+
 # Link agregate command
 # If there's nothing to link, create empty $@ object.
 quiet_cmd_ld_multi = LD   $@
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 812f904..c88d5c5 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -28,3 +28,5 @@ config.mak.autogen
 *-flex.*
 *.pyc
 *.pyo
+util/intel-pt-decoder/inat-tables.c
+util/intel-pt-decoder/inat.c
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5816a3b..3ae3a8e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -76,6 +76,12 @@ include config/utilities.mak
 #
 # Define NO_AUXTRACE if you do not want AUX area tracing support
 
+# As per kernel Makefile, avoid funny character set dependencies
+unexport LC_ALL
+LC_COLLATE=C
+LC_NUMERIC=C
+export LC_COLLATE LC_NUMERIC
+
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -122,6 +128,7 @@ INSTALL = install
 FLEX= flex
 BISON   = bison
 STRIP   = strip
+AWK = awk
 
 LIB_DIR  = $(srctree)/tools/lib/api/
 TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
@@ -272,7 +279,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf
 
 PERF_IN := $(OUTPUT)perf-in.o
 
-export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX
+export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
@@ -536,7 +543,8 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name 
'\.*.d' -delete
$(Q)$(RM) .config-detected
$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf 
perf-read-vdso32 perf-read-vdsox32
-   $(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc 
*/*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+   $(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc 
*/*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
+   $(OUTPUT)util/intel-pt-decoder/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat-tables.c
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
$(python-clean)
 
diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 9d67381..f5f7f87 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -1 +1,14 @@
-libperf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o
+libperf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o
+
+inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
+inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt
+
+$(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) 
$(inat_tables_maps)
+   @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) 
$(inat_tables_maps) > $@ || rm -f $@
+
+$(OUTPUT)util/intel-pt-decoder/inat.c:
+   @$(call echo-cmd,gen)cp ../../arch/x86/lib/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat.c
+
+$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
$(OUTPUT)util/intel-pt-decoder/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat-tables.c
+
+CFLAGS_intel-pt-insn-decoder.o += -I../../arch/x86/include 
-I$(OUTPUT)util/intel-pt-decoder -I../../arch/x86/lib -Wno-override-init
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
new file mode 100644
index 000..2fa82c5
--- /dev/null
+++ 

[PATCH V6 05/17] perf tools: Add Intel PT instruction decoder

2015-05-29 Thread Adrian Hunter
Add support for decoding instructions for Intel Processor Trace.  The
kernel x86 instruction decoder is used for this.

This essentially provides intel_pt_get_insn() which takes a binary
buffer, uses the kernel's x86 instruction decoder to get details
of the instruction and then categorizes it for consumption by
an Intel PT decoder.

Signed-off-by: Adrian Hunter adrian.hun...@intel.com
---
 tools/build/Makefile.build |   2 +
 tools/perf/.gitignore  |   2 +
 tools/perf/Makefile.perf   |  12 +-
 tools/perf/util/intel-pt-decoder/Build |  15 +-
 .../util/intel-pt-decoder/intel-pt-insn-decoder.c  | 246 +
 .../util/intel-pt-decoder/intel-pt-insn-decoder.h  |  65 ++
 6 files changed, 339 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
 create mode 100644 tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.h

diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 10df572..7ad74e4 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -57,6 +57,8 @@ quiet_cmd_cc_i_c = CPP  $@
 quiet_cmd_cc_s_c = AS   $@
   cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $
 
+quiet_cmd_gen = GEN  $@
+
 # Link agregate command
 # If there's nothing to link, create empty $@ object.
 quiet_cmd_ld_multi = LD   $@
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 812f904..c88d5c5 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -28,3 +28,5 @@ config.mak.autogen
 *-flex.*
 *.pyc
 *.pyo
+util/intel-pt-decoder/inat-tables.c
+util/intel-pt-decoder/inat.c
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5816a3b..3ae3a8e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -76,6 +76,12 @@ include config/utilities.mak
 #
 # Define NO_AUXTRACE if you do not want AUX area tracing support
 
+# As per kernel Makefile, avoid funny character set dependencies
+unexport LC_ALL
+LC_COLLATE=C
+LC_NUMERIC=C
+export LC_COLLATE LC_NUMERIC
+
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -122,6 +128,7 @@ INSTALL = install
 FLEX= flex
 BISON   = bison
 STRIP   = strip
+AWK = awk
 
 LIB_DIR  = $(srctree)/tools/lib/api/
 TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
@@ -272,7 +279,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf
 
 PERF_IN := $(OUTPUT)perf-in.o
 
-export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX
+export srctree OUTPUT RM CC LD AR CFLAGS V BISON FLEX AWK
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
@@ -536,7 +543,8 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name 
'\.*.d' -delete
$(Q)$(RM) .config-detected
$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf 
perf-read-vdso32 perf-read-vdsox32
-   $(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc 
*/*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+   $(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc 
*/*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE 
$(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
+   $(OUTPUT)util/intel-pt-decoder/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat-tables.c
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
$(python-clean)
 
diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 9d67381..f5f7f87 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -1 +1,14 @@
-libperf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o
+libperf-$(CONFIG_AUXTRACE) += intel-pt-pkt-decoder.o intel-pt-insn-decoder.o
+
+inat_tables_script = ../../arch/x86/tools/gen-insn-attr-x86.awk
+inat_tables_maps = ../../arch/x86/lib/x86-opcode-map.txt
+
+$(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) 
$(inat_tables_maps)
+   @$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) 
$(inat_tables_maps)  $@ || rm -f $@
+
+$(OUTPUT)util/intel-pt-decoder/inat.c:
+   @$(call echo-cmd,gen)cp ../../arch/x86/lib/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat.c
+
+$(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
$(OUTPUT)util/intel-pt-decoder/inat.c 
$(OUTPUT)util/intel-pt-decoder/inat-tables.c
+
+CFLAGS_intel-pt-insn-decoder.o += -I../../arch/x86/include 
-I$(OUTPUT)util/intel-pt-decoder -I../../arch/x86/lib -Wno-override-init
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
new file mode 100644
index 000..2fa82c5
--- /dev/null
+++