Re: [PATCH] perf evsel: Get group fd from CPU0 for system wide event

From: Jiri Olsa
Date: Mon May 04 2020 - 20:04:07 EST


On Sat, May 02, 2020 at 10:33:59AM +0800, Jin, Yao wrote:

SNIP

> > > @@ -1461,6 +1461,9 @@ static int get_group_fd(struct evsel *evsel, int cpu, int thread)
> > > BUG_ON(!leader->core.fd);
> > > fd = FD(leader, cpu, thread);
> > > + if (fd == -1 && leader->core.system_wide)
> >
> > fd does not need to be -1 in here.. in my setup cstate_pkg/c2-residency/
> > has cpumask 0, so other cpus never get open and are 0, and the whole thing
> > ends up with:
> >
> > sys_perf_event_open: pid -1 cpu 1 group_fd 0 flags 0
> > sys_perf_event_open failed, error -9
> >
> > I actualy thought we put -1 to fd array but couldn't find it.. perhaps we should od that
> >
> >
>
> I have tested on two platforms. On KBL desktop fd is 0 for this case, but on
> oncascadelakex server, fd is -1, so the BUG_ON(fd == -1) is triggered.
>
> > > + fd = FD(leader, 0, thread);
> > > +
> >
> > so how do we group following events?
> >
> > cstate_pkg/c2-residency/ - cpumask 0
> > msr/tsc/ - all cpus
> >
>
> Not sure if it's enough to only use cpumask 0 because
> cstate_pkg/c2-residency/ should be per-socket.
>
> > cpu 0 is fine.. the rest I have no idea ;-)
> >
>
> Perhaps we directly remove the BUG_ON(fd == -1) assertion?

I think we need to make clear how to deal with grouping over
events that comes for different cpus

so how do we group following events?

cstate_pkg/c2-residency/ - cpumask 0
msr/tsc/ - all cpus


what's the reason/expected output of groups with above events?
seems to make sense only if we limit msr/tsc/ to cpumask 0 as well

jirka