mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: <linux-kernel@vger.kernel.org>
Cc: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@elte.hu,
	acme@ghostprotocols.net
Subject: [PATCH] perf: Fix perf_event_for_each() to use sibling
Date: Wed, 11 Apr 2012 11:54:13 +1000	[thread overview]
Message-ID: <1334109253-31329-1-git-send-email-michael@ellerman.id.au> (raw)

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


             reply	other threads:[~2012-04-11  1:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11  1:54 Michael Ellerman [this message]
2012-04-26 12:16 ` [tip:perf/urgent] " tip-bot for Michael Ellerman
  -- strict thread matches above, loose matches on Subject: below --
2012-02-28 13:31 [PATCH] " Michael Ellerman

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=1334109253-31329-1-git-send-email-michael@ellerman.id.au \
    --to=michael@ellerman.id.au \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    /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®