• Athira Rajeev's avatar
    perf annotate: Set instruction name to be used with insn-stat when using raw instruction · 2c9db747
    Athira Rajeev authored
    Since the "ins.name" is not set while using raw instruction,
    'perf annotate' with insn-stat gives wrong data:
    
    Result from "./perf annotate --data-type --insn-stat":
    
      Annotate Instruction stats
      total 615, ok 419 (68.1%), bad 196 (31.9%)
    
        Name      :  Good   Bad
        -----------------------------------------------------------
                  :   419   196
    
    This patch sets "dl->ins.name" in arch specific function
    "check_ppc_insn" while initialising "struct disasm_line".
    
    Also update "ins_find" function to pass "struct disasm_line" as a
    parameter so as to set its name field in arch specific call.
    
    With the patch changes:
    
      Annotate Instruction stats
      total 609, ok 446 (73.2%), bad 163 (26.8%)
    
      Name/opcode         :  Good   Bad
      -----------------------------------------------------------
      58                  :   323    80
      32                  :    49    43
      34                  :    33    11
      OP_31_XOP_LDX       :     8    20
      40                  :    23     0
      OP_31_XOP_LWARX     :     5     1
      OP_31_XOP_LWZX      :     2     3
      OP_31_XOP_LDARX     :     3     0
      33                  :     0     2
      OP_31_XOP_LBZX      :     0     1
      OP_31_XOP_LWAX      :     0     1
      OP_31_XOP_LHZX      :     0     1
    Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
    Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Signed-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
    Tested-by: default avatarKajol Jain <kjain@linux.ibm.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Akanksha J N <akanksha@linux.ibm.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
    Cc: Hari Bathini <hbathini@linux.ibm.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
    Cc: Segher Boessenkool <segher@kernel.crashing.org>
    Link: https://lore.kernel.org/lkml/20240718084358.72242-16-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    2c9db747
annotate.c 65.7 KB