• Athira Rajeev's avatar
    perf vendor events powerpc: Update datasource event name to fix duplicate events · 9eef4101
    Athira Rajeev authored
    Running "perf list" on powerpc fails with segfault as below:
    
       $ ./perf list
       Segmentation fault (core dumped)
       $
    
    This happens because of duplicate events in the JSON list.  The powerpc
    JSON event list contains some event with same event name, but different
    event code. They are:
    
    - PM_INST_FROM_L3MISS (Present in datasource and frontend)
    - PM_MRK_DATA_FROM_L2MISS (Present in datasource and marked)
    - PM_MRK_INST_FROM_L3MISS (Present in datasource and marked)
    - PM_MRK_DATA_FROM_L3MISS (Present in datasource and marked)
    
    pmu_events_table__num_events() uses the value from table_pmu->num_entries
    which includes duplicate events as well. This causes issue during "perf
    list" and results in a segmentation fault.
    
    Since both event codes are valid, append _DSRC to the Data Source events
    (datasource.json), so that they would have a unique name.
    
    Also add PM_DATA_FROM_L2MISS_DSRC and PM_DATA_FROM_L3MISS_DSRC events.
    
    With the fix, 'perf list' works as expected.
    
    Fixes: fc143580 ("perf vendor events power10: Update JSON/events")
    Signed-off-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
    Tested-by: default avatarDisha Goel <disgoel@linux.ibm.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kajol Jain <kjain@linux.ibm.com>
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20231123160110.94090-1-atrajeev@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    9eef4101
datasource.json 95 KB