• Leo Yan's avatar
    perf cs-etm: Support sample flags 'insn' and 'insnlen' · a4973d8f
    Leo Yan authored
    The synthetic branch and instruction samples are missed to set
    instruction related info, thus the perf tool fails to display samples
    with flags '-F,+insn,+insnlen'.
    
    The CoreSight trace decoder provides sufficient information to decide
    the instruction size based on the ISA type: A64/A32 instructions are
    32-bit size, but one exception is the T32 instruction size, which might
    be 32-bit or 16-bit.
    
    This patch handles these cases and it reads the instruction values from
    DSO file; thus can support the flags '-F,+insn,+insnlen'.
    
    Before:
    
      # perf script -F,insn,insnlen,ip,sym
                    0 [unknown] ilen: 0
         ffff97174044 _start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
         ffff97174938 _dl_start ilen: 0
    
      [...]
    
    After:
    
      # perf script -F,insn,insnlen,ip,sym
                    0 [unknown] ilen: 0
         ffff97174044 _start ilen: 4 insn: 2f 02 00 94
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
         ffff97174938 _dl_start ilen: 4 insn: c1 ff ff 54
    
      [...]
    Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
    Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
    Tested-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Mike Leach <mike.leach@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Robert Walker <robert.walker@arm.com>
    Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
    Cc: coresight@lists.linaro.org
    Cc: linux-arm-kernel@lists.infradead.org
    Link: http://lkml.kernel.org/r/20190815082854.18191-1-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    a4973d8f
cs-etm.c 68.3 KB