Re: [PATCH v4 1/7] perf: Allow normal events to be sources of AUX data

From: Peter Zijlstra
Date: Mon Aug 05 2019 - 09:19:03 EST


On Mon, Aug 05, 2019 at 10:16:12AM +0300, Alexander Shishkin wrote:
> In some cases, ordinary (non-AUX) events can generate data for AUX events.
> For example, PEBS events can come out as records in the Intel PT stream
> instead of their usual DS records, if configured to do so.
>
> One requirement for such events is to consistently schedule together, to
> ensure that the data from the "AUX source" events isn't lost while their
> corresponding AUX event is not scheduled. We use grouping to provide this
> guarantee: an "AUX source" event can be added to a group where an AUX event
> is a group leader, and provided that the former supports writing to the
> latter.

Two niggles -- and sorry for not bringing those up sooner:

> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index 7198ddd0c6b1..213cae95e713 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -374,7 +374,8 @@ struct perf_event_attr {
> namespaces : 1, /* include namespaces data */
> ksymbol : 1, /* include ksymbol events */
> bpf_event : 1, /* include bpf events */
> - __reserved_1 : 33;
> + aux_source : 1, /* generate AUX records instead of events */
> + __reserved_1 : 32;
>
> union {
> __u32 wakeup_events; /* wakeup every n events */

The name: "aux_source" seems to imply that we change the source to
'aux', while in fact it is the destination we change.

So we want to %s/aux_source/aux_output/ on the whole thing?

> + /*
> + * Our group leader must be an aux event if we want to be
> + * an aux_source. This way, the aux event will precede its
> + * aux_source events in the group, and therefore will always
> + schedule first.
> + */

You fudged the comment there.