linux-stable/kernel/events
Namhyung Kim b2754b9c0b perf/core: Inherit event_caps
commit e3265a4386 upstream.

It was reported that some perf event setup can make fork failed on
ARM64.  It was the case of a group of mixed hw and sw events and it
failed in perf_event_init_task() due to armpmu_event_init().

The ARM PMU code checks if all the events in a group belong to the
same PMU except for software events.  But it didn't set the event_caps
of inherited events and no longer identify them as software events.
Therefore the test failed in a child process.

A simple reproducer is:

  $ perf stat -e '{cycles,cs,instructions}' perf bench sched messaging
  # Running 'sched/messaging' benchmark:
  perf: fork(): Invalid argument

The perf stat was fine but the perf bench failed in fork().  Let's
inherit the event caps from the parent.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20220328200112.457740-1-namhyung@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-13 19:27:38 +02:00
..
callchain.c uaccess: add force_uaccess_{begin,end} helpers 2020-08-12 10:57:59 -07:00
core.c perf/core: Inherit event_caps 2022-04-13 19:27:38 +02:00
hw_breakpoint.c perf/hw_breakpoint: Replace deprecated CPU-hotplug functions 2021-08-26 09:14:36 +02:00
internal.h tracing/perf: Add interrupt_context_level() helper 2021-10-19 20:33:20 -04:00
Makefile perf/core: allow ftrace for functions in kernel/event/core.c 2021-10-25 22:50:42 -04:00
ring_buffer.c perf: Cap allocation order at aux_watermark 2021-04-16 16:32:39 +02:00
uprobes.c mm/memcg: Convert mem_cgroup_charge() to take a folio 2021-09-27 09:27:31 -04:00