Patch "perf/core: Correct event creation with PERF_FORMAT_GROUP" has been added to the 4.4-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
perf/core: Correct event creation with PERF_FORMAT_GROUP
to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-core-correct-event-creation-with-perf_format_group.patch
and it can be found in the queue-4.4 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Apr 10 10:31:53 CEST 2018
From: Peter Zijlstra <[email protected]>
Date: Tue, 30 May 2017 11:45:12 +0200
Subject: perf/core: Correct event creation with PERF_FORMAT_GROUP
From: Peter Zijlstra <[email protected]>
[ Upstream commit ba5213ae6b88fb170c4771fef6553f759c7d8cdd ]
Andi was asking about PERF_FORMAT_GROUP vs inherited events, which led to the discovery of a bug from commit:
3dab77fb1bf8 ("perf: Rework/fix the whole read vs group stuff")
- PERF_SAMPLE_GROUP = 1U << 4, + PERF_SAMPLE_READ = 1U << 4,
- if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP))
+ if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP))
is a clear fail :/
While this changes user visible behaviour; it was previously possible to create an inherited event with PERF_SAMPLE_READ; this is deemed acceptible because its results were always incorrect.
--- kernel/events/core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/events/core.c +10 -5
@@ -5271,9 +5271,6 @@ static void perf_output_read_one(struct__output_copy (handle, values, n *sizeof (u64)); } -/* -* XXX PERF_FORMAT_GROUP vs inherited events seems difficult. -*/ static void perf_output_read_group (struct perf_output_handle *handle,struct perf_event *event,u64 enabled,u64 running)
@@ -5318,6 +5315,13 @@ static void perf_output_read_group(struc#define PERF_FORMAT_TOTAL_TIMES (PERF_FORMAT_TOTAL_TIME_ENABLED|\ PERF_FORMAT_TOTAL_TIME_RUNNING) +/* +* XXX PERF_SAMPLE_READ vs inherited events seems difficult. +* +* The problem is that its both hard and excessively expensive to iterate the +* child list, not to mention that its impossible to IPI the children running +* on another CPU, from interrupt/NMI context. +*/ static void perf_output_read (struct perf_output_handle *handle,struct perf_event *event) {
@@ -7958,9 +7962,10 @@ perf_event_alloc(struct perf_event_attrlocal64_set (&hwc->period_left, hwc->sample_period);/* -* we currently do not support PERF_FORMAT_GROUP on inherited events +* We currently do not support PERF_SAMPLE_READ on inherited events. +* See perf_output_read(). */ -if (attr->inherit && (attr->read_format &PERF_FORMAT_GROUP )) +if (attr->inherit && (attr->sample_type &PERF_SAMPLE_READ )) goto err_ns;if (!has_branch_stack (event))
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/perf-tools-fix-copyfile_offset-update-of-output-offset.patch queue-4.4/sched-numa-use-down_read_trylock-for-the-mmap_sem.patch queue-4.4/x86-asm-don-t-use-rbp-as-a-temporary-register-in-csum_partial_copy_generic.patch queue-4.4/perf-core-correct-event-creation-with-perf_format_group.patch queue-4.4/x86-tsc-provide-tsc-unstable-boot-parameter.patch