Good suggestion! I will send a new version. On Wed, May 15, 2024 at 1:58 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > On Fri, May 10, 2024 at 12:14:21PM -0700, Yabin Cui wrote: > > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > > index d2a15c0c6f8a..9fc55193ff99 100644 > > --- a/include/linux/perf_event.h > > +++ b/include/linux/perf_event.h > > @@ -1240,12 +1240,16 @@ static inline void perf_sample_save_callchain(struct perf_sample_data *data, > > } > > > > static inline void perf_sample_save_raw_data(struct perf_sample_data *data, > > + struct perf_event *event, > > struct perf_raw_record *raw) > > { > > struct perf_raw_frag *frag = &raw->frag; > > u32 sum = 0; > > int size; > > > > + if (!(event->attr.sample_type & PERF_SAMPLE_RAW)) > > + return; > > + > > Should we add something like: > > if (WARN_ON_ONCE(data->sample_flags & PERF_SAMPLE_RAW)) > return; > > ? And I suppose the same for all these other patches. > > > do { > > sum += frag->size; > > if (perf_raw_frag_last(frag)) > >