public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec
@ 2011-11-22  3:30 Deng-Cheng Zhu
  2011-11-22 10:51 ` Peter Zijlstra
  0 siblings, 1 reply; 12+ messages in thread
From: Deng-Cheng Zhu @ 2011-11-22  3:30 UTC (permalink / raw)
  To: a.p.zijlstra
  Cc: eyal, zenon, Deng-Cheng Zhu, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, Ralf Baechle, LKML

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@mips.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: LKML <linux-kernel@vger.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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-12-06  9:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22  3:30 [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec Deng-Cheng Zhu
2011-11-22 10:51 ` Peter Zijlstra
2011-11-22 13:24   ` Zhu, DengCheng
2011-11-22 13:45     ` Peter Zijlstra
2011-11-22 14:20       ` Zhu, DengCheng
2011-11-22 14:23         ` Peter Zijlstra
2011-11-23  3:38           ` Deng-Cheng Zhu
2011-11-23 11:39             ` Peter Zijlstra
2011-11-23 12:40               ` Zhu, DengCheng
2011-11-23 12:48                 ` Peter Zijlstra
2011-11-24  3:06                   ` Deng-Cheng Zhu
2011-12-06  9:47               ` [tip:perf/core] perf: Fix enable_on_exec for sibling events tip-bot for Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox