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-next>] [day] [month] [year] [list]
Message-ID: <1289369711.2430.38.camel@minggr.sh.intel.com>
Date:	Wed, 10 Nov 2010 14:15:11 +0800
From:	Lin Ming <ming.m.lin@...el.com>
To:	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
	Matt Fleming <matt@...sole-pimps.org>
Cc:	Zhang Rui <rui.zhang@...el.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	lkml <linux-kernel@...r.kernel.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [RFC PATCH 1/2] perf: Enable group siblings on exec if
 attr::enable_on_exec set

Currently, only group leader is enabled on exec.
This patch enables all group events on exec if attr::enable_on_exec is
set.

This is needed by next patch.

Signed-off-by: Lin Ming <ming.m.lin@...el.com>
---
 kernel/perf_event.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 517d827..b94c18d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -1700,11 +1700,29 @@ static int event_enable_on_exec(struct perf_event *event,
 	if (event->state >= PERF_EVENT_STATE_INACTIVE)
 		return 0;
 
-	__perf_event_mark_enabled(event, ctx);
+	event->state = PERF_EVENT_STATE_INACTIVE;
 
 	return 1;
 }
 
+static int group_enable_on_exec(struct perf_event *event,
+				struct perf_event_context *ctx)
+{
+	int enabled = 0;
+	struct perf_event *sub;
+
+	list_for_each_entry(sub, &event->sibling_list, group_entry)
+		if (event_enable_on_exec(sub, ctx))
+			enabled++;
+
+	if (event_enable_on_exec(event, ctx))
+		enabled++;
+
+	__perf_event_mark_enabled(event, ctx);
+
+	return enabled;
+}
+
 /*
  * Enable all of a task's events that have been marked enable-on-exec.
  * This expects task == current.
@@ -1725,13 +1743,13 @@ static void perf_event_enable_on_exec(struct perf_event_context *ctx)
 	raw_spin_lock(&ctx->lock);
 
 	list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
-		ret = event_enable_on_exec(event, ctx);
+		ret = group_enable_on_exec(event, ctx);
 		if (ret)
 			enabled = 1;
 	}
 
 	list_for_each_entry(event, &ctx->flexible_groups, group_entry) {
-		ret = event_enable_on_exec(event, ctx);
+		ret = group_enable_on_exec(event, ctx);
 		if (ret)
 			enabled = 1;
 	}
-- 
1.7.1



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ