lkml.org 
[lkml]   [2013]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:perf/core] perf: Fix broken union in ' struct perf_event_mmap_page'
On Wed, 18 Sep 2013, Peter Zijlstra wrote:

> On Wed, Sep 18, 2013 at 10:19:32AM -0400, Vince Weaver wrote:
> > Can you point to any code that is fixed by the commit?
>
> I have some, but I don't think a lot of people use it.
>
> Would you be ok with something like the below? It should preserve
> functionality for code that only cares about cap_usr_rdpmc (PAPI).
>
> Stephane, does libpfm use any of these?
>
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -380,8 +380,8 @@ struct perf_event_mmap_page {
> union {
> __u64 capabilities;
> struct {
> - __u64 cap_usr_time : 1,
> - cap_usr_rdpmc : 1,
> + __u64 cap_usr_rdpmc : 1,
> + cap_usr_time : 1,
> cap_usr_time_zero : 1,
> cap_____res : 61;
> };
>

It would be nice if there was some way to detect this change; I liked the
idea of a "cap_usr_fixed" bit.

Even with your change you can't have code that can reliably detect both
cap_usr_time and cap_usr_rdpmc unless you can guarantee that both
perf_event.h and the kernel are 3.12 or newer, and it gets more
complicated if distros backport this patch.

Tools like PAPI often carry around their own copy of perf_event.h and
people like to move around binaries between machines with different kernel
versions so things get complicated quickly.

Vince


\
 
 \ /
  Last update: 2013-09-18 22:21    [W:0.099 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site