lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-1d899c0e9bc2a17895762b9457ac336cdee8e072@git.kernel.org>
Date:   Mon, 21 Jan 2019 03:18:35 -0800
From:   tip-bot for Andrew Murray <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     acme@...nel.org, mingo@...nel.org, mattst88@...il.com,
        shawnguo@...nel.org, s.hauer@...gutronix.de, will.deacon@....com,
        bp@...en8.de, ink@...assic.park.msu.ru, linux@...linux.org.uk,
        benh@...nel.crashing.org, tglx@...utronix.de, peterz@...radead.org,
        mpe@...erman.id.au, rth@...ddle.net, paulus@...ba.org,
        andrew.murray@....com, mark.rutland@....com,
        linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
        hpa@...or.com
Subject: [tip:perf/core] perf/core, arch/arm: Use PERF_PMU_CAP_NO_EXCLUDE
 conditionally

Commit-ID:  1d899c0e9bc2a17895762b9457ac336cdee8e072
Gitweb:     https://git.kernel.org/tip/1d899c0e9bc2a17895762b9457ac336cdee8e072
Author:     Andrew Murray <andrew.murray@....com>
AuthorDate: Thu, 10 Jan 2019 13:53:27 +0000
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Mon, 21 Jan 2019 11:01:22 +0100

perf/core, arch/arm: Use PERF_PMU_CAP_NO_EXCLUDE conditionally

The ARM PMU driver can be used to represent a variety of ARM based
PMUs. Some of these PMUs do not provide support for context
exclusion, where this is the case we advertise the
PERF_PMU_CAP_NO_EXCLUDE capability to ensure that perf prevents us
from handling events where any exclusion flags are set.

Where an ARM PMU driver has the set_event_filter function implemented,
we rely on it to perform exclusion checks. At present some of these
functions do not test for all of the available exclude flags.

Signed-off-by: Andrew Murray <andrew.murray@....com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Acked-by: Will Deacon <will.deacon@....com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Ivan Kokshaysky <ink@...assic.park.msu.ru>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Mark Rutland <mark.rutland@....com>
Cc: Matt Turner <mattst88@...il.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Richard Henderson <rth@...ddle.net>
Cc: Russell King <linux@...linux.org.uk>
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: Shawn Guo <shawnguo@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linuxppc-dev@...ts.ozlabs.org
Cc: robin.murphy@....com
Cc: suzuki.poulose@....com
Link: https://lkml.kernel.org/r/1547128414-50693-6-git-send-email-andrew.murray@arm.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 drivers/perf/arm_pmu.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index d0b7dd8fb184..eec75b97e7ea 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -356,13 +356,6 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev)
 	return ret;
 }
 
-static int
-event_requires_mode_exclusion(struct perf_event_attr *attr)
-{
-	return attr->exclude_idle || attr->exclude_user ||
-	       attr->exclude_kernel || attr->exclude_hv;
-}
-
 static int
 __hw_perf_event_init(struct perf_event *event)
 {
@@ -393,9 +386,8 @@ __hw_perf_event_init(struct perf_event *event)
 	/*
 	 * Check whether we need to exclude the counter from certain modes.
 	 */
-	if ((!armpmu->set_event_filter ||
-	     armpmu->set_event_filter(hwc, &event->attr)) &&
-	     event_requires_mode_exclusion(&event->attr)) {
+	if (armpmu->set_event_filter &&
+	    armpmu->set_event_filter(hwc, &event->attr)) {
 		pr_debug("ARM performance counters do not support "
 			 "mode exclusion\n");
 		return -EOPNOTSUPP;
@@ -867,6 +859,9 @@ int armpmu_register(struct arm_pmu *pmu)
 	if (ret)
 		return ret;
 
+	if (!pmu->set_event_filter)
+		pmu->pmu.capabilities |= PERF_PMU_CAP_NO_EXCLUDE;
+
 	ret = perf_pmu_register(&pmu->pmu, pmu->name, -1);
 	if (ret)
 		goto out_destroy;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ