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]
Date:	Tue, 22 Nov 2011 11:30:01 +0800
From:	Deng-Cheng Zhu <dczhu@...s.com>
To:	<a.p.zijlstra@...llo.nl>
CC:	<eyal@...s.com>, <zenon@...s.com>, Deng-Cheng Zhu <dczhu@...s.com>,
	Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Ralf Baechle <ralf@...ux-mips.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec

Currently, when grouped events are created disabled and enable-on-exec, the
siblings won't be enabled on exec in fact. The problem looks like this:

======================================================================
-sh-4.0# perf stat -g -e r14,cycles,instructions,r12 find / >/dev/null
^Cfind: Interrupt

 Performance counter stats for 'find /':

          60684699 r14
     <not counted> cycles
     <not counted> instructions
     <not counted> r12

       4.291975113 seconds time elapsed
======================================================================

This patch fixes it.

Signed-off-by: Deng-Cheng Zhu <dczhu@...s.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Ralf Baechle <ralf@...ux-mips.org>
Cc: LKML <linux-kernel@...r.kernel.org>
---
 kernel/events/core.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0e8457d..300bc66 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1651,6 +1651,8 @@ retry:
 	raw_spin_unlock_irq(&ctx->lock);
 }
 
+static int event_enable_on_exec(struct perf_event *event,
+				struct perf_event_context *ctx);
 /*
  * Put a event into inactive state and update time fields.
  * Enabling the leader of a group effectively enables all
@@ -1668,6 +1670,7 @@ static void __perf_event_mark_enabled(struct perf_event *event,
 	event->state = PERF_EVENT_STATE_INACTIVE;
 	event->tstamp_enabled = tstamp - event->total_time_enabled;
 	list_for_each_entry(sub, &event->sibling_list, group_entry) {
+		event_enable_on_exec(sub, sub->ctx);
 		if (sub->state >= PERF_EVENT_STATE_INACTIVE)
 			sub->tstamp_enabled = tstamp - sub->total_time_enabled;
 	}
-- 
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