* [PATCH] perf: Fix perf_event_for_each() to use sibling
@ 2012-04-11 1:54 Michael Ellerman
2012-04-26 12:16 ` [tip:perf/urgent] " tip-bot for Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2012-04-11 1:54 UTC (permalink / raw)
To: linux-kernel; +Cc: a.p.zijlstra, paulus, mingo, acme
In perf_event_for_each() we call a function on an event, and then
iterate over the siblings of the event.
However we don't call the function on the siblings, we call it
repeatedly on the original event - it seems "obvious" that we should
be calling it with sibling as the argument.
It looks like this broke in commit 75f937f24bd9 ("Fix ctx->mutex
vs counter->mutex inversion").
The only effect of the bug is that the PERF_IOC_FLAG_GROUP parameter
to the ioctls doesn't work.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
This one seems so simple that I keep thinking I've missed something,
I'm sure someone will tell me if I have ;)
AFAICS tools/perf never exercises this, ie. it always individually
enables counters - which might explain how it could be broken and
no one has noticed.
---
kernel/events/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 1b5c081..b82121b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3097,7 +3097,7 @@ static void perf_event_for_each(struct perf_event *event,
perf_event_for_each_child(event, func);
func(event);
list_for_each_entry(sibling, &event->sibling_list, group_entry)
- perf_event_for_each_child(event, func);
+ perf_event_for_each_child(sibling, func);
mutex_unlock(&ctx->mutex);
}
--
1.7.5.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [tip:perf/urgent] perf: Fix perf_event_for_each() to use sibling
2012-04-11 1:54 [PATCH] perf: Fix perf_event_for_each() to use sibling Michael Ellerman
@ 2012-04-26 12:16 ` tip-bot for Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Michael Ellerman @ 2012-04-26 12:16 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, a.p.zijlstra, michael, tglx
Commit-ID: 724b6daa13e100067c30cfc4d1ad06629609dc4e
Gitweb: http://git.kernel.org/tip/724b6daa13e100067c30cfc4d1ad06629609dc4e
Author: Michael Ellerman <michael@ellerman.id.au>
AuthorDate: Wed, 11 Apr 2012 11:54:13 +1000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 26 Apr 2012 13:51:31 +0200
perf: Fix perf_event_for_each() to use sibling
In perf_event_for_each() we call a function on an event, and then
iterate over the siblings of the event.
However we don't call the function on the siblings, we call it
repeatedly on the original event - it seems "obvious" that we should
be calling it with sibling as the argument.
It looks like this broke in commit 75f937f24bd9 ("Fix ctx->mutex
vs counter->mutex inversion").
The only effect of the bug is that the PERF_IOC_FLAG_GROUP parameter
to the ioctls doesn't work.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1334109253-31329-1-git-send-email-michael@ellerman.id.au
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/events/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a6a9ec4..fd126f8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3183,7 +3183,7 @@ static void perf_event_for_each(struct perf_event *event,
perf_event_for_each_child(event, func);
func(event);
list_for_each_entry(sibling, &event->sibling_list, group_entry)
- perf_event_for_each_child(event, func);
+ perf_event_for_each_child(sibling, func);
mutex_unlock(&ctx->mutex);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-26 12:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 1:54 [PATCH] perf: Fix perf_event_for_each() to use sibling Michael Ellerman
2012-04-26 12:16 ` [tip:perf/urgent] " tip-bot for Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome