Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1301146 > unrolled thread

perf_event_open() ABI compatability

Started byVince Weaver <vincent.weaver@maine.edu>
First post2016-01-04 23:20 +0100
Last post2016-01-11 12:30 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  perf_event_open() ABI compatability Vince Weaver <vincent.weaver@maine.edu> - 2016-01-04 23:20 +0100
    Re: perf_event_open() ABI compatability Peter Zijlstra <peterz@infradead.org> - 2016-01-05 10:10 +0100
      Re: perf_event_open() ABI compatability Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2016-01-11 11:40 +0100
        Re: perf_event_open() ABI compatability Ingo Molnar <mingo@kernel.org> - 2016-01-11 12:30 +0100

#1301146 — perf_event_open() ABI compatability

FromVince Weaver <vincent.weaver@maine.edu>
Date2016-01-04 23:20 +0100
Subjectperf_event_open() ABI compatability
Message-ID<qNlDP-14y-9@gated-at.bofh.it>
So I think this might be revisiting an issue that has come up before, but
we're having backward compatability issues with PAPI and libpfm4 and
the perf_event_open() system call.

If a user specifies exclude_guest=1 on an older kernel that doesn't 
support it, we get the awesome EINVAL error return code and it often
takes hours to track down the cause.

Now in theory the ABI is maintained via the "size" field.  So you can
figure out the size of the attr struct by setting an invalid size
and then getting E2BIG with size set to the value the kernel expects.
		
This doesn't help with exclude_guest though, as that's in the giant union
in the middle of the attr, and there's absolutely no mechanism at all
to tell when that has been extended.

Is there any solution to all of this, except having to carry around a big 
table of kernel version numbers for when features were added?

Ideally we would somehow want E2BIG returned plus the size of __reserved_1 
if the value of __reserved_1 is not zero.  I suppose at this point in the 
game it's too late for this to be much help and we're going to have to
work around the problem forever anyway.

Vince
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1301342

FromPeter Zijlstra <peterz@infradead.org>
Date2016-01-05 10:10 +0100
Message-ID<qNvMS-8om-9@gated-at.bofh.it>
In reply to#1301146
On Mon, Jan 04, 2016 at 05:19:13PM -0500, Vince Weaver wrote:
> 
> So I think this might be revisiting an issue that has come up before, but
> we're having backward compatability issues with PAPI and libpfm4 and
> the perf_event_open() system call.
> 
> If a user specifies exclude_guest=1 on an older kernel that doesn't 
> support it, we get the awesome EINVAL error return code and it often
> takes hours to track down the cause.
> 
> Now in theory the ABI is maintained via the "size" field.  So you can
> figure out the size of the attr struct by setting an invalid size
> and then getting E2BIG with size set to the value the kernel expects.
> 		
> This doesn't help with exclude_guest though, as that's in the giant union
> in the middle of the attr, and there's absolutely no mechanism at all
> to tell when that has been extended.
> 
> Is there any solution to all of this, except having to carry around a big 
> table of kernel version numbers for when features were added?

The perf tool does a probe thing where it will, in reverse order of
feature addition remove flags.

The advantage of the dynamic probing is that it will work with franken
kernels that have bits backported; where relying on the kernel version
number is pointless.

But yes, this is all somewhat fugly.

> Ideally we would somehow want E2BIG returned plus the size of __reserved_1 
> if the value of __reserved_1 is not zero.  I suppose at this point in the 
> game it's too late for this to be much help and we're going to have to
> work around the problem forever anyway.

Right :/ So I was hoping some of that extended error reporting stuff
from Alexander Shishkin would help out with this. Not sure where that
stranded -- I think in the attempt to make it too generic or so.

But yes, since that too will only be available in new kernels, old
kernels will still have to cope.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1306035

FromAlexander Shishkin <alexander.shishkin@linux.intel.com>
Date2016-01-11 11:40 +0100
Message-ID<qPI3h-13k-51@gated-at.bofh.it>
In reply to#1301342
Peter Zijlstra <peterz@infradead.org> writes:

> On Mon, Jan 04, 2016 at 05:19:13PM -0500, Vince Weaver wrote:
>> 
>> So I think this might be revisiting an issue that has come up before, but
>> we're having backward compatability issues with PAPI and libpfm4 and
>> the perf_event_open() system call.
>> 
>> If a user specifies exclude_guest=1 on an older kernel that doesn't 
>> support it, we get the awesome EINVAL error return code and it often
>> takes hours to track down the cause.
>> 
>> Now in theory the ABI is maintained via the "size" field.  So you can
>> figure out the size of the attr struct by setting an invalid size
>> and then getting E2BIG with size set to the value the kernel expects.
>> 		
>> This doesn't help with exclude_guest though, as that's in the giant union
>> in the middle of the attr, and there's absolutely no mechanism at all
>> to tell when that has been extended.
>> 
>> Is there any solution to all of this, except having to carry around a big 
>> table of kernel version numbers for when features were added?
>
> The perf tool does a probe thing where it will, in reverse order of
> feature addition remove flags.
>
> The advantage of the dynamic probing is that it will work with franken
> kernels that have bits backported; where relying on the kernel version
> number is pointless.
>
> But yes, this is all somewhat fugly.
>
>> Ideally we would somehow want E2BIG returned plus the size of __reserved_1 
>> if the value of __reserved_1 is not zero.  I suppose at this point in the 
>> game it's too late for this to be much help and we're going to have to
>> work around the problem forever anyway.
>
> Right :/ So I was hoping some of that extended error reporting stuff
> from Alexander Shishkin would help out with this. Not sure where that
> stranded -- I think in the attempt to make it too generic or so.

Yep. I can respin it back into perf-specific shape, so do we still want
it?

Regards,
--
Alex

[toc] | [prev] | [next] | [standalone]


#1306095

FromIngo Molnar <mingo@kernel.org>
Date2016-01-11 12:30 +0100
Message-ID<qPIPE-1Dk-21@gated-at.bofh.it>
In reply to#1306035
* Alexander Shishkin <alexander.shishkin@linux.intel.com> wrote:

> >> Ideally we would somehow want E2BIG returned plus the size of __reserved_1 if 
> >> the value of __reserved_1 is not zero.  I suppose at this point in the game 
> >> it's too late for this to be much help and we're going to have to work around 
> >> the problem forever anyway.
> >
> > Right :/ So I was hoping some of that extended error reporting stuff from 
> > Alexander Shishkin would help out with this. Not sure where that stranded -- I 
> > think in the attempt to make it too generic or so.
> 
> Yep. I can respin it back into perf-specific shape, so do we still want it?

Yeah, please do!

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web