• Ian Rogers's avatar
    perf pmus: Sort/merge/aggregate PMUs like mrvl_ddr_pmu · 3241d46f
    Ian Rogers authored
    The mrvl_ddr_pmu is uncore and has a hexadecimal address suffix while
    the previous PMU sorting/merging code assumes uncore PMU names start
    with uncore_ and have a decimal suffix. Because of the previous
    assumption it isn't possible to wildcard the mrvl_ddr_pmu.
    
    Modify pmu_name_len_no_suffix but also remove the suffix number out
    argument, this is because we don't know if a suffix number of say 100
    is in hexadecimal or decimal. As the only use of the suffix number is
    in comparisons, it is safe there to compare the values as hexadecimal.
    Modify perf_pmu__match_ignoring_suffix so that hexadecimal suffixes
    are ignored.
    
    Only allow hexadecimal suffixes to be greater than length 2 (ie 3 or
    more) so that S390's cpum_cf PMU doesn't lose its suffix.
    
    Change the return type of pmu_name_len_no_suffix to size_t to
    workaround GCC incorrectly determining the result could be negative.
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Cc: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Robin Murphy <robin.murphy@arm.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Will Deacon <will@kernel.org>
    Cc: Thomas Richter <tmricht@linux.ibm.com>
    Cc: Bharat Bhushan <bbhushan2@marvell.com>
    Cc: Bhaskara Budiredla <bbudiredla@marvell.com>
    Cc: Tuan Phan <tuanphan@os.amperecomputing.com>
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20240515060114.3268149-2-irogers@google.com
    3241d46f
pmus.c 17.9 KB