Re: [PATCH v5 12/26] perf parse-events: Support event inside hybrid pmu

From: Jiri Olsa
Date: Mon Apr 26 2021 - 17:34:49 EST


On Mon, Apr 26, 2021 at 08:56:28AM +0800, Jin, Yao wrote:
> Hi Jiri,
>
> On 4/26/2021 12:17 AM, Jiri Olsa wrote:
> > On Fri, Apr 23, 2021 at 01:35:27PM +0800, Jin Yao wrote:
> >
> > SNIP
> >
> > > +static int parse_events__inside_hybrid_pmu(struct parse_events_state *parse_state,
> > > + struct list_head *list, char *name,
> > > + struct list_head *head_config)
> > > +{
> > > + struct parse_events_term *term;
> > > + int ret = -1;
> > > +
> > > + if (parse_state->fake_pmu || !head_config || list_empty(head_config) ||
> > > + !perf_pmu__is_hybrid(name)) {
> > > + return -1;
> > > + }
> > > +
> > > + /*
> > > + * More than one term in list.
> > > + */
> > > + if (head_config->next && head_config->next->next != head_config)
> > > + return -1;
> > > +
> > > + term = list_first_entry(head_config, struct parse_events_term, list);
> > > + if (term && term->config && strcmp(term->config, "event")) {
> >
> > so 'event' is set only for HW events, I don't see it being for other
> > types.. also should the check be !strcmp ?
> >
>
> For some HW events, such as branch-instructions, branch-misses and other HW
> events which are defined under /sys/devices/cpu_core/events, the
> term->config is "event". For these events, we don't need to do the second
> parsing. So I just use 'strcmp(term->config, "event")' to avoid the second
> parsing.

ah ok.. I thought it's the other way round


>
> If we check with !strcmp, the second parsing will be executed but the result
> after parsing should be empty.
>
> > also please add some tests for cache events with pmu syntax
> >
>
> OK, I will add new test case for that.

thanks,
jirka