On Tue, Sep 05, 2017 at 04:30:16PM +0300, Alexander Shishkin wrote: > Allow PMUs to supply additional static information that may be required > by their decoders. Most of what Intel PT driver exports as capability > attributes (timing packet freqencies, frequency ratios etc), its decoder > needs to be able to correctly decode its binary stream. However, when > decoding Intel PT stream from a core dump, we can't rely on the sysfs > attributes, so we need to pack this information into the perf buffer, > so that the resulting core dump is self-contained. > > In order to do this, we append a PMU-specific structure to the user > page. Such structures will include size, for versioning. >
> @@ -508,6 +513,18 @@ struct perf_addr_filters_head { > unsigned int nr_file_filters; > }; > > +struct pmu_info { > + /* > + * Size of this structure, for versioning. > + */ > + u32 note_size; > + > + /* > + * Size of the container structure, not including this one > + */ > + u32 pmu_descsz; > +}; > + > /** > * enum perf_event_active_state - the states of a event > */ > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > index 3d64d9ea80..4cdd4fab9d 100644 > --- a/include/uapi/linux/perf_event.h > +++ b/include/uapi/linux/perf_event.h > @@ -599,6 +599,16 @@ struct perf_event_mmap_page { > __u64 aux_tail; > __u64 aux_offset; > __u64 aux_size; > + > + /* > + * PMU data: static info that (AUX) decoder wants to know in order to > + * decode correctly: > + * > + * pmu_offset >= sizeof(struct perf_event_mmap_page) > + * pmu_offset + pmu_size <= PAGE_SIZE > + */ > + __u64 pmu_offset; > + __u64 pmu_size; > }; Why like this? Why not dump the data as part of PERF_RECORD_ITRACE_START/PERF_RECORD_AUX ?