mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Deng-Cheng Zhu <dczhu@mips.com>
To: <a.p.zijlstra@chello.nl>
Cc: <eyal@mips.com>, <zenon@mips.com>,
	Deng-Cheng Zhu <dczhu@mips.com>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Ralf Baechle <ralf@linux-mips.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec
Date: Tue, 22 Nov 2011 11:30:01 +0800	[thread overview]
Message-ID: <1321932601-21128-1-git-send-email-dczhu@mips.com> (raw)

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


             reply	other threads:[~2011-11-22  3:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22  3:30 Deng-Cheng Zhu [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321932601-21128-1-git-send-email-dczhu@mips.com \
    --to=dczhu@mips.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=eyal@mips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=zenon@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®