[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YGxaOnUZnNmDg/2P@krava>
Date: Tue, 6 Apr 2021 14:55:22 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: John Garry <john.garry@...wei.com>
Cc: will@...nel.org, mathieu.poirier@...aro.org, leo.yan@...aro.org,
peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
namhyung@...nel.org, irogers@...gle.com, linuxarm@...wei.com,
kjain@...ux.ibm.com, kan.liang@...ux.intel.com,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
zhangshaokun@...ilicon.com, pc@...ibm.com
Subject: Re: [PATCH v2 2/6] perf test: Handle metric reuse in pmu-events
parsing test
On Tue, Apr 06, 2021 at 01:43:09PM +0100, John Garry wrote:
> On 06/04/2021 13:17, Jiri Olsa wrote:
> > > > > + ref = &metric->metric_ref;
> > > > > + ref->metric_name = pe->metric_name;
> > > > > + ref->metric_expr = pe->metric_expr;
> > > > > + list_add_tail(&metric->list, compound_list);
> > > > > +
> > > > > + rc = expr__find_other(pe->metric_expr, NULL, pctx, 0);
> > > Hi Jirka,
> > >
> > > > so this might add new items to pctx->ids, I think you need
> > > > to restart the iteration as we do it in __resolve_metric
> > > > otherwise you could miss some new keys
> > > I thought that I was doing this. Indeed, this code is very much like
> > > __resolve_metric();)
> > >
> > > So expr__find_other() may add a new item to pctx->ids, and we always iterate
> > > again, and try to lookup any pmu_events, *, above. If none exist, then we
> > hm, I don't see that.. so, what you do is:
> >
> > hashmap__for_each_entry_safe((&pctx->ids) ....) {
> >
> > rc = expr__find_other(pe->metric_expr, NULL, pctx, 0);
> > }
> >
> > and what I think we need to do is:
> >
> > hashmap__for_each_entry_safe((&pctx->ids) ....) {
> >
> > rc = expr__find_other(pe->metric_expr, NULL, pctx, 0);
> >
> > break;
> > }
> >
> > each time you resolve another metric, you need to restart
> > the pctx->ids iteration, because there will be new items,
> > and we are in the middle of it
>
> Sure, but we will restart anyway.
hum, where? you call expr__find_other and continue to next
pctx->ids item
>
> Regardless of this, I don't think what I am doing is safe, i.e. adding new
> items in the middle of the iter, so I will change in the way you suggest.
it'll always add items in the middle of the iteration
jirka
>
> Thanks,
> John
>
Powered by blists - more mailing lists