[PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec

From: Deng-Cheng Zhu
Date: Mon Nov 21 2011 - 22:30:37 EST


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@xxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxxxx>
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/