perf_events: Fix races in group composition
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 27 May 2010 13:47:49 +0000 (15:47 +0200)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 16 Jan 2013 21:45:07 +0000 (16:45 -0500)
commite732ebc42aea321ee84514330eb3a675307fcc83
treeb81a93b56e3c75e284504cf542c4c916e45ec789
parent9cb08e9f1df7113af1cf28534d73ef3adb419017
perf_events: Fix races in group composition

commit 8a49542c0554af7d0073aac0ee73ee65b807ef34 upstream.

Group siblings don't pin each-other or the parent, so when we destroy
events we must make sure to clean up all cross referencing pointers.

In particular, for destruction of a group leader we must be able to
find all its siblings and remove their reference to it.

This means that detaching an event from its context must not detach it
from the group, otherwise we can end up failing to clear all pointers.

Solve this by clearly separating the attachment to a context and
attachment to a group, and keep the group composed until we destroy
the events.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
include/linux/perf_event.h
kernel/perf_event.c