Re: [RFC PATCH v1 12/15] perf evlist: Add reference count
From: Arnaldo Carvalho de Melo
Date: Thu Oct 30 2025 - 09:09:47 EST
On Wed, Oct 29, 2025 at 02:12:11PM -0700, Ian Rogers wrote:
> On Wed, Oct 29, 2025 at 11:33 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > On Wed, Oct 29, 2025 at 09:56:50AM -0700, Ian Rogers wrote:
> > > On Wed, Oct 29, 2025 at 9:22 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > > On Tue, Oct 28, 2025 at 10:34:10PM -0700, Ian Rogers wrote:
> > > > > This a no-op for most of the perf tool. The reference count is set to
> > > > > 1 at allocation, the put will see the 1, decrement it and perform the
> > > > > delete. The purpose for adding the reference count is for the python
> > > > > code. Prior to this change the python code would clone evlists, but
> > > > > this has issues if events are opened, etc. This change adds a
> > > > > reference count for the evlists and a later change will add it to
> > > > > evsels. The combination is needed for the python code to operate
> > > > > correctly (not hit asserts in the evsel clone), but the changes are
> > > > > broken apart for the sake of smaller patches.
> > > > Looks ok, noisy for all the s/delete/put/ but that is ok, but then you
> > > > are not using the RC_CHK_ACCESS stuff from the get go, why not?
> > > So if I did RC_CHK_ACCESS then every evsel access would need updating,
> > Fair enough, I think it would be informative to have a comment
> > mentioning this near the refcount_t to avoid this question popping up
> > again.
> Sgtm. I think we can also add the RC_CHK_ACCESS to evlist as that is a
> boring blob of a thing to pass around.
> How are things outside of this? The python changes, how to do the
> process_events callbacks, etc. Any thoughts on the tool API vs the
> script API (stat vs stat_round) ?
I'll try and resume reviewing at that point, but I don't antecipate
problems and like the direction of this work.
- Arnaldo