[PATCH v5 29/34] perf pmus: Allow just core PMU scanning

Ravi Bangoria ravi.bangoria at amd.com
Thu Jun 8 23:12:57 PDT 2023


Hi Ian,

> diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
> index 08ac3ea2e366..c5596230a308 100644
> --- a/tools/perf/util/mem-events.c
> +++ b/tools/perf/util/mem-events.c
> @@ -136,10 +136,7 @@ int perf_mem_events__init(void)
>  		} else {
>  			struct perf_pmu *pmu = NULL;
>  
> -			while ((pmu = perf_pmus__scan(pmu)) != NULL) {
> -				if (!pmu->is_core)
> -					continue;
> -
> +			while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
>  				scnprintf(sysfs_name, sizeof(sysfs_name),
>  					  e->sysfs_name, pmu->name);
>  				e->supported |= perf_mem_event__supported(mnt, sysfs_name);

As I mentioned in other patch, AMD ibs_op// currently belongs to "other_pmus"
list and perf mem/c2c uses IBS on AMD. perf mem/c2c on AMD are working even
after applying this patch because e->sysfs_name contains "ibs_op" and thus
sysfs_name contains "ibs_op", although pmu->name is "cpu".

Let me try to fix it. Suggestions are welcome :)

> @@ -176,10 +173,7 @@ static void perf_mem_events__print_unsupport_hybrid(struct perf_mem_event *e,
>  	char sysfs_name[100];
>  	struct perf_pmu *pmu = NULL;
>  
> -	while ((pmu = perf_pmus__scan(pmu)) != NULL) {
> -		if (!pmu->is_core)
> -			continue;
> -
> +	while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
>  		scnprintf(sysfs_name, sizeof(sysfs_name), e->sysfs_name,
>  			  pmu->name);
>  		if (!perf_mem_event__supported(mnt, sysfs_name)) {
> @@ -217,9 +211,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr,
>  				return -1;
>  			}
>  
> -			while ((pmu = perf_pmus__scan(pmu)) != NULL) {
> -				if (!pmu->is_core)
> -					continue;
> +			while ((pmu = perf_pmus__scan_core(pmu)) != NULL) {
>  				rec_argv[i++] = "-e";
>  				s = perf_mem_events__name(j, pmu->name);
>  				if (s) {

Thanks,
Ravi



More information about the linux-arm-kernel mailing list