2014-12-03 04:55:59

by Vince Weaver

[permalink] [raw]
Subject: perf: attr backwards compatability issues


So PAPI reshuffled the way it used libpfm4 and ended up inadvertently
setting exclude_guest=1.

This managed to break anyone using the new version of the library (with
a modern verison of the perf_event.h header) on kernels older than 3.2,
with a helpful EINVAL return.

After a lot of false leads this was tracked to the

if (attr->__reserved_1)
return -EINVAL;

line in kernel/events.c (any hope of the better error reporting
happening?)

Anyway, this is completely useless backwards compatability wise.

Shouldn't that return be E2BIG to be consistent with the way that
extensions to the ABI are handled elsewhere in the interface
(i.e. report E2BIG if a formerly unused bit is set to 1)?

Though I guess it's too late to change this behavior now.

I looked to see how perf handles this issue, but I guess conveniently
any new bitfield values are designed in such a way that the perf default
behavior matches up with a zero for the new setting.

Vince