From: Deng-Cheng Zhu <dczhu@mips.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "Barzilay, Eyal" <eyal@mips.com>,
"Fortuna, Zenon" <zenon@mips.com>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
"ralf@linux-mips.org" <ralf@linux-mips.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec
Date: Wed, 23 Nov 2011 11:38:20 +0800 [thread overview]
Message-ID: <4ECC6AAC.4010504@mips.com> (raw)
In-Reply-To: <1321971798.14799.12.camel@twins>
On 11/22/2011 10:23 PM, Peter Zijlstra wrote:
> On Tue, 2011-11-22 at 14:20 +0000, Zhu, DengCheng wrote:
>>> @@ -2463,11 +2461,25 @@ static int event_enable_on_exec(struct p
>>> if (event->state>= PERF_EVENT_STATE_INACTIVE)
>>> return 0;
>>>
>>> - __perf_event_mark_enabled(event, ctx);
>>> + event->state = PERF_EVENT_STATE_INACTIVE;
>>>
>>> return 1;
>>> }
>>
>> By simply setting the event state in here, we bypass time stamp stuff as a result.
>> This might lead to inaccuracies...
>
> Ah, but it calls a __perf_event_mark_enabled() at the tail of
> group_enable_on_exec() which should fix that up, right?
Oh, yes. Aside from a slight piece that the __perf_event_mark_enabled()
in group_enable_on_exec() will reassign PERF_EVENT_STATE_INACTIVE to the
group leader, your patch looks good.
In fact, my another candidate for this patch is as follows (The
comment of perf_event_enable_on_exec() says "Enable all of a task's
events that have been marked enable-on-exec", so I think the added
traversal makes sense in here):
From: Deng-Cheng Zhu <dczhu@mips.com>
Date: Wed, 23 Nov 2011 11:31:18 +0800
Subject: [PATCH] perf: Enable enable-on-exec siblings
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:
======================================================================
-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>
---
kernel/events/core.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0e8457d..63527d0 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2476,6 +2476,12 @@ static void perf_event_enable_on_exec(struct
perf_event_context *ctx)
raw_spin_lock(&ctx->lock);
task_ctx_sched_out(ctx);
+ list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
+ ret = event_enable_on_exec(event, ctx);
+ if (ret)
+ enabled = 1;
+ }
+
list_for_each_entry(event, &ctx->pinned_groups, group_entry) {
ret = event_enable_on_exec(event, ctx);
if (ret)
next prev parent reply other threads:[~2011-11-23 3:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=4ECC6AAC.4010504@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.