Re: [PATCH v14 00/32] perf tools: Add evsel to perf_sample
From: Arnaldo Carvalho de Melo
Date: Thu May 21 2026 - 09:41:17 EST
On Wed, May 20, 2026 at 03:43:52PM -0700, Ian Rogers wrote:
> On Wed, May 20, 2026 at 3:32 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> > I'll look at the perf-data-validation branch. Would it be okay to post
> > the patches to LKML so that we can get the Sashiko review on them?
> In "perf session: Bound nr_cpus_avail and validate sample CPU" the
> perf_session__deliver_event change appears to inline
> evlist__parse_sample which seems unfortunate from a code reuse
> point-of-view. The commit message calls this out but doesn't describe
> the motivation for the change. Could we fix evlist__parse_sample?
The motivation:
18 -Also refactor the sample parsing in perf_session__deliver_event()
19 -to call evsel__parse_sample() directly (via evlist__event2evsel()
20 -for evsel lookup), with explicit guest VM SID resolution for
21 -machine_pid and vcpu fields.
18 +Inline evlist__parse_sample() into perf_session__deliver_event()
19 +so the evsel lookup needed for sample_type checking reuses the same
20 +evsel that parsed the sample, avoiding a second evlist__event2evsel()
21 +call on every event.
A follow up patch could introduce a evlist__parse_sample variation that
passes a evsel pointer address where to store the evsel used so that it
can be reused and avoid the duplicate lookup.
- Arnaldo