Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2c9091d authored by Andrew Murray's avatar Andrew Murray Committed by Ingo Molnar
Browse files

perf/core, arch/powerpc: use PERF_PMU_CAP_NO_EXCLUDE for exclusion incapable PMUs



For PowerPC PMUs that do not support context exclusion let's
advertise the PERF_PMU_CAP_NO_EXCLUDE capability. This ensures that
perf will prevent us from handling events where any exclusion flags
are set. Let's also remove the now unnecessary check for exclusion
flags.

Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: robin.murphy@arm.com
Cc: suzuki.poulose@arm.com
Link: https://lkml.kernel.org/r/1547128414-50693-10-git-send-email-andrew.murray@arm.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a66b0010
Loading
Loading
Loading
Loading
+1 −9
Original line number Original line Diff line number Diff line
@@ -1306,15 +1306,6 @@ static int h_24x7_event_init(struct perf_event *event)
		return -EINVAL;
		return -EINVAL;
	}
	}


	/* unsupported modes and filters */
	if (event->attr.exclude_user   ||
	    event->attr.exclude_kernel ||
	    event->attr.exclude_hv     ||
	    event->attr.exclude_idle   ||
	    event->attr.exclude_host   ||
	    event->attr.exclude_guest)
		return -EINVAL;

	/* no branch sampling */
	/* no branch sampling */
	if (has_branch_stack(event))
	if (has_branch_stack(event))
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
@@ -1577,6 +1568,7 @@ static struct pmu h_24x7_pmu = {
	.start_txn   = h_24x7_event_start_txn,
	.start_txn   = h_24x7_event_start_txn,
	.commit_txn  = h_24x7_event_commit_txn,
	.commit_txn  = h_24x7_event_commit_txn,
	.cancel_txn  = h_24x7_event_cancel_txn,
	.cancel_txn  = h_24x7_event_cancel_txn,
	.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
};
};


static int hv_24x7_init(void)
static int hv_24x7_init(void)
+1 −9
Original line number Original line Diff line number Diff line
@@ -232,15 +232,6 @@ static int h_gpci_event_init(struct perf_event *event)
		return -EINVAL;
		return -EINVAL;
	}
	}


	/* unsupported modes and filters */
	if (event->attr.exclude_user   ||
	    event->attr.exclude_kernel ||
	    event->attr.exclude_hv     ||
	    event->attr.exclude_idle   ||
	    event->attr.exclude_host   ||
	    event->attr.exclude_guest)
		return -EINVAL;

	/* no branch sampling */
	/* no branch sampling */
	if (has_branch_stack(event))
	if (has_branch_stack(event))
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
@@ -285,6 +276,7 @@ static struct pmu h_gpci_pmu = {
	.start       = h_gpci_event_start,
	.start       = h_gpci_event_start,
	.stop        = h_gpci_event_stop,
	.stop        = h_gpci_event_stop,
	.read        = h_gpci_event_update,
	.read        = h_gpci_event_update,
	.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
};
};


static int hv_gpci_init(void)
static int hv_gpci_init(void)
+1 −18
Original line number Original line Diff line number Diff line
@@ -473,15 +473,6 @@ static int nest_imc_event_init(struct perf_event *event)
	if (event->hw.sample_period)
	if (event->hw.sample_period)
		return -EINVAL;
		return -EINVAL;


	/* unsupported modes and filters */
	if (event->attr.exclude_user   ||
	    event->attr.exclude_kernel ||
	    event->attr.exclude_hv     ||
	    event->attr.exclude_idle   ||
	    event->attr.exclude_host   ||
	    event->attr.exclude_guest)
		return -EINVAL;

	if (event->cpu < 0)
	if (event->cpu < 0)
		return -EINVAL;
		return -EINVAL;


@@ -748,15 +739,6 @@ static int core_imc_event_init(struct perf_event *event)
	if (event->hw.sample_period)
	if (event->hw.sample_period)
		return -EINVAL;
		return -EINVAL;


	/* unsupported modes and filters */
	if (event->attr.exclude_user   ||
	    event->attr.exclude_kernel ||
	    event->attr.exclude_hv     ||
	    event->attr.exclude_idle   ||
	    event->attr.exclude_host   ||
	    event->attr.exclude_guest)
		return -EINVAL;

	if (event->cpu < 0)
	if (event->cpu < 0)
		return -EINVAL;
		return -EINVAL;


@@ -1069,6 +1051,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
	pmu->pmu.stop = imc_event_stop;
	pmu->pmu.stop = imc_event_stop;
	pmu->pmu.read = imc_event_update;
	pmu->pmu.read = imc_event_update;
	pmu->pmu.attr_groups = pmu->attr_groups;
	pmu->pmu.attr_groups = pmu->attr_groups;
	pmu->pmu.capabilities = PERF_PMU_CAP_NO_EXCLUDE;
	pmu->attr_groups[IMC_FORMAT_ATTR] = &imc_format_group;
	pmu->attr_groups[IMC_FORMAT_ATTR] = &imc_format_group;


	switch (pmu->domain) {
	switch (pmu->domain) {