[PATCH 5/8] drivers/perf: hisi: Update DDRC PMU for programable counter

John Garry john.garry at huawei.com
Tue Jan 26 10:56:45 EST 2021


On 26/01/2021 12:33, John Garry wrote:
>>   }
>> @@ -332,8 +506,16 @@ static int hisi_ddrc_pmu_probe(struct 
>> platform_device *pdev)
>>           return ret;
>>       }
>> -    name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "hisi_sccl%u_ddrc%u",
>> -                  ddrc_pmu->sccl_id, ddrc_pmu->index_id);
>> +    if (ddrc_pmu->identifier >= HISI_PMU_V2)
>> +        name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
>> +                      "hisi_sccl%u_ddrc%u_%u",
>> +                      ddrc_pmu->sccl_id, ddrc_pmu->index_id,
>> +                      ddrc_pmu->sub_id);

I think that this is actually ok for perf.

Checking pmu_uncore_alias_match():

bool pmu_uncore_alias_match(const char *pmu_name, const char *name)
{
	char *tmp = NULL, *tok, *str;
	bool res;

...

	for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) {
		name = strstr(name, tok);
		if (!name) {
			res = false;
			goto out;
		}
	}

	...
}

We match each token in @pmu_name, "hisi_sccl,ddrc". So we would match 
"hisi_sccl%u_" part with "hisi_sccl" token and then match "ddrc%u_%u" 
with "ddrc" token.

But it would be good to triple check. We need the JSON files created at 
some stage anyway :)

> 
> I don't think perf can support event aliasing in this format 
> (hisi_scclX_Y_Z), but I need to double-check.
> 
>> +    else
>> +        name = devm_kasprintf(&pdev->dev, GFP_KERNEL, 




More information about the linux-arm-kernel mailing list