On 03/31/2017 07:03 PM, Stephane Eranian wrote:
> Hi,
> 
> 
> On Thu, Mar 23, 2017 at 8:31 AM, William Cohen <wco...@redhat.com> wrote:
>>
>> Hi Stephane,
>>
>> There is ABI change between libpfm-4.7 and libpfm-4.8 that is visible
>> to programs using libpfm that break compatability.  This change can be
>> observed with libabigail's abidiff command
>> (https://sourceware.org/libabigail/manual/abidiff.html) I found that
>> following patch has changed the layout of struct pfm_event_attr_info_t
>> in pfmlib.h:
>>
>> commit 4dc4c6ada254f30eee8cd2ae27bb0869a111b613
>> Author: Stephane Eranian <eran...@gmail.com>
>> Date:   Sat May 28 03:49:04 2016 +0200
>>
>>     Allow raw umask for OFFCORE_RESPONSE on Intel core PMUs
>>
>>     This patch makes it possible to specify the raw umask as
>>     hexadecimal for the Intel core PMU OFFCORE_RESPONSE_* event.
>>     This makes it possible to encode a umask which could have been
>>     omitted by mistake from the library or not yet supported.
>>
>>     $ examples/check_events offcore_response_0:0xffff
>>
>>     Added validation tests for this new support.
>>
>>     Signed-off-by: Stephane Eranian <eran...@gmail.com>
>>
>> --------------------------- include/perfmon/pfmlib.h 
>> ---------------------------
>> index 24a2a60..8921164 100644
>> @@ -420,8 +420,8 @@ typedef struct {
>>         size_t                  size;   /* struct sizeof */
>>         uint64_t                code;   /* attribute code */
>>         pfm_attr_t              type;   /* attribute type */
>> -       int                     idx;    /* attribute opaque index */
>> -       pfm_attr_ctrl_t         ctrl;           /* what is providing attr */
>> +       uint64_t                idx;    /* attribute opaque index */
>> +       pfm_attr_ctrl_t         ctrl;   /* what is providing attr */
>>         struct {
>>                 unsigned int    is_dfl:1;       /* is default umask */
>>                 unsigned int    is_precise:1;   /* Intel X86: supports PEBS 
>> */
>>
>>
>>
>> The struct in libpfm-4.7 is
>>
>> typedef struct {
>>         const char              *name;  /* attribute symbolic name */
>>         const char              *desc;  /* attribute description */
>>         const char              *equiv; /* attribute is equivalent to */
>>         size_t                  size;   /* struct sizeof */
>>         uint64_t                code;   /* attribute code */
>>         pfm_attr_t              type;   /* attribute type */
>>         int                     idx;    /* attribute opaque index */
>>         pfm_attr_ctrl_t         ctrl;           /* what is providing attr */
>>         struct {
>>                 unsigned int    is_dfl:1;       /* is default umask */
>>                 unsigned int    is_precise:1;   /* Intel X86: supports PEBS 
>> */
>>                 unsigned int    reserved_bits:30;
>>         } SWIG_NAME(flags);
>>         union {
>>                 uint64_t        dfl_val64;      /* default 64-bit value */
>>                 const char      *dfl_str;       /* default string value */
>>                 int             dfl_bool;       /* default boolean value */
>>                 int             dfl_int;        /* default integer value */
>>         } SWIG_NAME(defaults);
>> } pfm_event_attr_info_t;
>>
>> The patch changes idx from a 32-bit to 64-bit value.  This causes
>> padding (made explicit by commit
>> 06b296c72838be44d8950dc03227fe0dc8ca1fb1) to be inserted so idx and
>> following fields are at different locations in the struct.  The struct
>> is also made 8 bytes larger (512 bits to 576 bits).
>>
> Ok, my bad. That was not my goal here.
> We can revert this change. But to enable support, this struct will
> need to change.
> So it will incur some ABI change.

Hi Stephane,

Yes, limiting the idx to 32-bit will prevent a number of offcore events from 
working properly.  

In the comment it says "/* attribute opaque index */" for idx.  Would it be 
possible to make that an index into a table of raw umask values?

-Will
> 
>>
>> abidiff /usr/lib64/libpfm.so.4.7.0 libpfm.so
>> ...
>>   [C]'function int pfm_get_event_attr_info(int, int, pfm_os_t, 
>> pfm_event_attr_info_t*)' at pfmlib_common.c:1812:1 has some indirect 
>> sub-type changes:
>>     parameter 4 of type 'pfm_event_attr_info_t*' has sub-type changes:
>>       in pointed to type 'typedef pfm_event_attr_info_t' at pfmlib.h:507:1:
>>         underlying type 'struct __anonymous_struct__' at pfmlib.h:486:1 
>> changed:
>>           type size changed from 512 to 576 bits
>>           1 data member insertion:
>>             'int __anonymous_struct__::pad', at offset 352 (in bits) at 
>> pfmlib.h:493:1
>>           3 data member changes:
>>            type of 'int __anonymous_struct__::idx' changed:
>>              entity changed from 'int' to compatible type 'typedef uint64_t' 
>> at stdint.h:55:1
>>                type name changed from 'int' to 'unsigned long int'
>>                type size changed from 32 to 64 bits
>>            and offset changed from 352 to 384 (in bits)
>>            'pfm_attr_ctrl_t __anonymous_struct__::ctrl' offset changed from 
>> 384 to 448 (in bits)
>>            '__anonymous_struct__ ' offset changed from 416 to 480 (in bits)
>>
>> ...
>>
>> -Will


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to