linux/kernel/events
Jiri Olsa c8af898923 perf: Fix events installation during moving group
commit 9fc81d8742 upstream.

We allow PMU driver to change the cpu on which the event
should be installed to. This happened in patch:

  e2d37cd213 ("perf: Allow the PMU driver to choose the CPU on which to install events")

This patch also forces all the group members to follow
the currently opened events cpu if the group happened
to be moved.

This and the change of event->cpu in perf_install_in_context()
function introduced in:

  0cda4c0231 ("perf: Introduce perf_pmu_migrate_context()")

forces group members to change their event->cpu,
if the currently-opened-event's PMU changed the cpu
and there is a group move.

Above behaviour causes problem for breakpoint events,
which uses event->cpu to touch cpu specific data for
breakpoints accounting. By changing event->cpu, some
breakpoints slots were wrongly accounted for given
cpu.

Vinces's perf fuzzer hit this issue and caused following
WARN on my setup:

   WARNING: CPU: 0 PID: 20214 at arch/x86/kernel/hw_breakpoint.c:119 arch_install_hw_breakpoint+0x142/0x150()
   Can't find any breakpoint slot
   [...]

This patch changes the group moving code to keep the event's
original cpu.

Reported-by: Vince Weaver <vince@deater.net>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Vince Weaver <vince@deater.net>
Cc: Yan, Zheng <zheng.z.yan@intel.com>
Link: http://lkml.kernel.org/r/1418243031-20367-3-git-send-email-jolsa@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-16 06:59:34 -08:00
..
Makefile uprobes: Move to kernel/events/ 2012-02-22 11:08:00 +01:00
callchain.c perf: Roll back callchain buffer refcount under the callchain mutex 2013-08-16 17:55:50 +02:00
core.c perf: Fix events installation during moving group 2015-01-16 06:59:34 -08:00
hw_breakpoint.c hw_breakpoint: Introduce "struct bp_cpuinfo" 2013-06-20 17:58:57 +02:00
internal.h perf: Fix arch_perf_out_copy_user default 2013-11-06 12:34:25 +01:00
ring_buffer.c perf: Optimize ring-buffer write by depending on control dependencies 2013-12-11 15:53:22 +01:00
uprobes.c uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME 2014-12-06 15:55:33 -08:00