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: <1477787923-61185-30-git-send-email-davidcc@google.com>
Date:   Sat, 29 Oct 2016 17:38:26 -0700
From:   David Carrillo-Cisneros <davidcc@...gle.com>
To:     linux-kernel@...r.kernel.org
Cc:     "x86@...nel.org" <x86@...nel.org>, Ingo Molnar <mingo@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Andi Kleen <ak@...ux.intel.com>,
        Kan Liang <kan.liang@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Vegard Nossum <vegard.nossum@...il.com>,
        Marcelo Tosatti <mtosatti@...hat.com>,
        Nilay Vaish <nilayvaish@...il.com>,
        Borislav Petkov <bp@...e.de>,
        Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
        Ravi V Shankar <ravi.v.shankar@...el.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Paul Turner <pjt@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        David Carrillo-Cisneros <davidcc@...gle.com>
Subject: [PATCH v3 29/46] perf/x86/intel/cmt: add error handling to intel_cmt_event_read

First part of intel_cmt_event_read. Error conditions and placeholder
for oncoming chunks.

Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.com>
---
 arch/x86/events/intel/cmt.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/x86/events/intel/cmt.c b/arch/x86/events/intel/cmt.c
index ef1000f..f5ab48e 100644
--- a/arch/x86/events/intel/cmt.c
+++ b/arch/x86/events/intel/cmt.c
@@ -1320,6 +1320,31 @@ static struct monr *monr_next_descendant_post(struct monr *pos,
 
 static int intel_cmt_event_read(struct perf_event *event)
 {
+	struct monr *monr = monr_from_event(event);
+
+	/*
+	 * preemption disabled since called holding
+	 * event's ctx->lock raw_spin_lock.
+	 */
+	WARN_ON_ONCE(!preempt_count());
+
+	/* terminated monrs are zombies and must not be read. */
+	if (WARN_ON_ONCE(monr->flags & CMT_MONR_ZOMBIE))
+		return -ENXIO;
+
+	/*
+	 * Only event parent can return a value, everyone else share its
+	 * rmid and therefore doesn't track occupancy independently.
+	 */
+	if (event->parent) {
+		local64_set(&event->count, 0);
+		return 0;
+	}
+
+	if (event->attach_state & PERF_ATTACH_TASK) {
+		/* To add support in next patches in series */
+		return -ENOTSUPP;
+	}
 	/* To add support in next patches in series */
 	return -ENOTSUPP;
 }
-- 
2.8.0.rc3.226.g39d4020

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ