I assume the reason for this being disabled is the difficulty to read child events once in perf overflow routine, thus the perf_output_read_group function. The read syscall function perf_event_read_group seems to handle this nicely.
My goal is to be able to read all events in group on leader sample by using the PERF_SAMPLE_READ with PERF_FORMAT_GROUP format. Once the monitored process forks, I need the child processes/events do the same and store samples into parents ring buffer. So I need all events sample just to report their own value (without child events being included). Thus switching the perf_event_count call for simple read of event->count. Reported-by: Jen-Cheng(Tommy) Huang <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Corey Ashford <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jen-Cheng(Tommy) Huang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> --- kernel/events/core.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index a1d220cf739b..315502bf733b 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -4611,9 +4611,6 @@ static void perf_output_read_one(struct perf_output_handle *handle, __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) @@ -4634,7 +4631,7 @@ static void perf_output_read_group(struct perf_output_handle *handle, if (leader != event) leader->pmu->read(leader); - values[n++] = perf_event_count(leader); + values[n++] = local64_read(&leader->count); if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(leader); @@ -4647,7 +4644,7 @@ static void perf_output_read_group(struct perf_output_handle *handle, (sub->state == PERF_EVENT_STATE_ACTIVE)) sub->pmu->read(sub); - values[n++] = perf_event_count(sub); + values[n++] = local64_read(&sub->count); if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(sub); @@ -6956,12 +6953,6 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, local64_set(&hwc->period_left, hwc->sample_period); - /* - * we currently do not support PERF_FORMAT_GROUP on inherited events - */ - if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP)) - goto err_ns; - pmu = perf_init_event(event); if (!pmu) goto err_ns; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

