• Andi Kleen's avatar
    perf tools x86: Add support for recording and printing XMM registers · ca138a7a
    Andi Kleen authored
    Icelake and later platforms support collecting XMM registers with PEBS
    event.
    
    Add support for 'perf script' to dump them, and support for the register
    parser in 'perf record -I=' ... to configure them.
    
    For now they are just printed in hex, we could potentially later add
    other formats too.
    
    Committer testing:
    
    Before:
    
      # perf record -IXMM0
      Warning:
      unknown register XMM0, check man page or run 'perf record -I?'
    
       Usage: perf record [<options>] [<command>]
          or: perf record [<options>] -- <command> [<options>]
    
      #
      # perf record -I?
      available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15
    
       Usage: perf record [<options>] [<command>]
          or: perf record [<options>] -- <command> [<options>]
      #
    
    After:
    
      # perf record -IXMM0
      Error:
      The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (cycles).
      /bin/dmesg | grep -i perf may provide additional information.
    
      #
      # perf record -I?
      available registers: AX BX CX DX SI DI BP SP IP FLAGS CS SS R8 R9 R10 R11 R12 R13 R14 R15 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 XMM9 XMM10 XMM11 XMM12 XMM13 XMM14 XMM15
    
       Usage: perf record [<options>] [<command>]
          or: perf record [<options>] -- <command> [<options>]
    
          -I, --intr-regs[=<any register>]
                                sample selected machine registers on interrupt, use -I ? to list register names
      #
    
    More work is needed to, when faced with such error, warn the user that
    that register is not available on the running platform.
    Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/20190506141926.13659-1-kan.liang@linux.intel.comSigned-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    ca138a7a
perf_regs.h 993 Bytes