From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759416AbcAKKat (ORCPT ); Mon, 11 Jan 2016 05:30:49 -0500 Received: from mga02.intel.com ([134.134.136.20]:62847 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759159AbcAKKaq (ORCPT ); Mon, 11 Jan 2016 05:30:46 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,552,1444719600"; d="scan'208";a="631563204" From: Alexander Shishkin To: Peter Zijlstra , Vince Weaver Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Arnaldo Carvalho de Melo , Stephane Eranian Subject: Re: perf_event_open() ABI compatability In-Reply-To: <20160105090904.GY6357@twins.programming.kicks-ass.net> References: <20160105090904.GY6357@twins.programming.kicks-ass.net> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 11 Jan 2016 12:30:42 +0200 Message-ID: <87fuy49zn1.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra 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