Skip to content

Commit

Permalink
perf: Fix group moving
Browse files Browse the repository at this point in the history
Matt found we trigger the WARN_ON_ONCE() in perf_group_attach() when we take
the move_group path in perf_event_open().

Since we cannot de-construct the group (we rely on it to move the events), we
have to simply ignore the double attach. The group state is context invariant
and doesn't need changing.

Reported-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1287135757.29097.1368.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Oct 18, 2010
1 parent e360adb commit 74c3337
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,12 @@ static void perf_group_attach(struct perf_event *event)
{
struct perf_event *group_leader = event->group_leader;

WARN_ON_ONCE(event->attach_state & PERF_ATTACH_GROUP);
/*
* We can have double attach due to group movement in perf_event_open.
*/
if (event->attach_state & PERF_ATTACH_GROUP)
return;

event->attach_state |= PERF_ATTACH_GROUP;

if (group_leader == event)
Expand Down

0 comments on commit 74c3337

Please sign in to comment.