mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vince Weaver <vincent.weaver@maine.edu>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Stephane Eranian <eranian@gmail.com>
Subject: perf_event_open() ABI compatability
Date: Mon, 4 Jan 2016 17:19:13 -0500 (EST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1601041523180.3608@macbook-air> (raw)


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

             reply	other threads:[~2016-01-04 22:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 22:19 Vince Weaver [this message]
2016-01-05  9:09 ` Peter Zijlstra
2016-01-11 10:30   ` Alexander Shishkin
2016-01-11 11:28     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1601041523180.3608@macbook-air \
    --to=vincent.weaver@maine.edu \
    --cc=acme@kernel.org \
    --cc=eranian@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®