• John Garry's avatar
    perf pmu: Fix alias matching · c07d5c92
    John Garry authored
    Commit c47a5599 ("perf tools: Fix pattern matching for same
    substring in different PMU type"), may have fixed some alias matching,
    but has broken some others.
    
    Firstly it cannot handle the simple scenario of PMU name in form
    pmu_name{digits} - it can only handle pmu_name_{digits}.
    
    Secondly it cannot handle more complex matching in the case where we
    have multiple tokens. In this scenario, the code failed to realise that
    we may examine multiple substrings in the PMU name.
    
    Fix in two ways:
    
    - Change perf_pmu__valid_suffix() to accept a PMU name without '_' in the
      suffix
    
    - Only pay attention to perf_pmu__valid_suffix() for the final token
    
    Also add const qualifiers as necessary to avoid casting.
    
    Fixes: c47a5599 ("perf tools: Fix pattern matching for same substring in different PMU type")
    Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
    Tested-by: default avatarJin Yao <yao.jin@linux.intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Kajol Jain <kjain@linux.ibm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lore.kernel.org/lkml/1626793819-79090-1-git-send-email-john.garry@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    c07d5c92
pmu.c 40.6 KB