[PATCH V1] perf: qcom: Add L3 cache PMU driver

Peter Zijlstra peterz at infradead.org
Tue Mar 22 13:48:33 PDT 2016


On Fri, Mar 18, 2016 at 04:37:02PM -0400, Agustin Vega-Frias wrote:
> +static int qcom_l3_cache_pmu_probe(struct platform_device *pdev)
> +{
> +	int result;
> +
> +	INIT_LIST_HEAD(&l3cache_pmu.pmus);
> +
> +	atomic_set(&l3cache_pmu.cpu, -1);
> +	l3cache_pmu.pmu = (struct pmu) {
> +		.task_ctx_nr	= perf_hw_context,

This cannot be right. There should only be a single perf_hw_context
driver in the system and that is typically the core pmu.

Also, since this is an L3 PMU, it seems very unlikely that these events
are actually per logical CPU, which is required for per-task events.

If these events are indeed not per logical CPU but per L3 cluster, you
should designate a single logical CPU per cluster to handle these
events. See for example arch/x86/events/intel/rapl.c for a relatively
simple PMU driver that has similar constraints.

> +		.name		= "l3cache",
> +		.pmu_enable	= qcom_l3_cache__pmu_enable,
> +		.pmu_disable	= qcom_l3_cache__pmu_disable,
> +		.event_init	= qcom_l3_cache__event_init,
> +		.add		= qcom_l3_cache__event_add,
> +		.del		= qcom_l3_cache__event_del,
> +		.start		= qcom_l3_cache__event_start,
> +		.stop		= qcom_l3_cache__event_stop,
> +		.read		= qcom_l3_cache__event_read,
> +
> +		.event_idx	= dummy_event_idx,

perf_event_idx_default() wasn't good enough?

> +		.attr_groups	= qcom_l3_cache_pmu_attr_grps,
> +	};



More information about the linux-arm-kernel mailing list