Re: perf: PERF_FLAG_FD_OUTPUT has been broken since 2.6.35

From: Peter Zijlstra
Date: Tue Jan 13 2015 - 04:36:23 EST


On Fri, Jan 09, 2015 at 11:26:54AM -0500, Vince Weaver wrote:
>
> On Fri, 9 Jan 2015, Peter Zijlstra wrote:
> > > So is this worth fixing seeing as apparently no one uses this feature?
> >
> > I think there's a fair argument for removing it, Ingo, Acme?
>
> could the functionality be replaced with a subsequent call to
> ioctl(PERF_EVENT_IOC_SET_OUTPUT)

Yes.

> Although I suppose there's a possibility for losing a small amount of data
> or some other reason that PERF_FLAG_FD_OUTPUT was introduced in the first
> place.

That's a natural race without solution. That is, because there is no
serialization between the sys_perf_event_open() and any possible acts of
data generation, we can't even talk about loosing data.

Even if it were all in a single syscall, there is no saying how long
that syscall would take to complete -- imagine its stuck on memory
allocation or whatnot. Similarly you could have issued the syscall a wee
bit later or whatnot.

> In addition, if we remove PERF_FLAG_FD_OUTPUT would there then be any
> reason to keep PERF_FLAG_FD_NO_GROUP around?

Good point, I think there was another potential user of that proposed
recently, but I can't quite remember where or what. Let me try and go
find that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/