Skip to contentSkip to conversation

perf: fix perf_event.h header usage

PATCH In review Stephane Eranian 3 participants 4 messages Jan 4, 2011 – Jan 5, 2011 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: fix perf_event.h header usage

This patch fixes the usage of the perf_event.h header file between command modules and the supporting code in util.

It is necessary to ensure that ALL files use the SAME perf_event.h header from the kernel source tree.

There were a couple of #include <linux/perf_event.h> mixed with #include "../../perf_event.h".

This caused issues on some distros because of mismatch in the layout of struct perf_event_attr. That eventually led perf stat to segfault.

---

tools/perf/util/evsel.h +1 -1
index 863d78d..a0ccd69 100644
@@ -3,7 +3,7 @@
 
 #include <linux/list.h>
 #include <stdbool.h>
-#include <linux/perf_event.h>
+#include "../../../include/linux/perf_event.h"
 #include "types.h"
 #include "xyarray.h"
  
tools/perf/util/parse-events.h +1 -1
index 1c9043c..b82cafb 100644
@@ -4,7 +4,7 @@
  * Parse symbolic events/counts passed in as options:
  */
 
-#include <linux/perf_event.h>
+#include "../../../include/linux/perf_event.h"
 
 struct list_head;
 struct perf_evsel;
#1 lore raw

Em Tue, Jan 04, 2011 at 04:30:01PM +0200, Stephane Eranian escreveu:

Quoted 6 lines

This patch fixes the usage of the perf_event.h header file between command modules and the supporting code in util.

It is necessary to ensure that ALL files use the SAME perf_event.h header from the kernel source tree.

Quoted 8 lines

There were a couple of #include <linux/perf_event.h> mixed with #include "../../perf_event.h".

This caused issues on some distros because of mismatch in the layout of struct perf_event_attr. That eventually led perf stat to segfault.

Thanks, applying.

- Arnaldo

#2 lore raw
Quoted 10 lines · Arnaldo Carvalho de Melo

Em Tue, Jan 04, 2011 at 04:30:01PM +0200, Stephane Eranian escreveu:

Quoted 9 lines

This patch fixes the usage of the perf_event.h header file between command modules and the supporting code in util.

It is necessary to ensure that ALL files use the SAME perf_event.h header from the kernel source tree.

There were a couple of #include <linux/perf_event.h> mixed with #include "../../perf_event.h".

Quoted 7 lines
Quoted 5 lines

This caused issues on some distros because of mismatch in the layout of struct perf_event_attr. That eventually led perf stat to segfault.

Thanks, applying.

Isn't this valid for all <linux/*.h> header files?

-Robert

Signature · 2 lines
Advanced Micro Devices, Inc.
Operating System Research Center
#3 lore raw

[tip:perf/core] perf tools: Fix perf_event.h header usage

In reply to Stephane Eranian
Commit-ID:  d030260ad33b482a371f999c7e9db79ef7a2111f
Gitweb:     http://git.kernel.org/tip/d030260ad33b482a371f999c7e9db79ef7a2111f
Author:     Stephane Eranian <[email protected]>
AuthorDate: Tue, 4 Jan 2011 16:30:01 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 5 Jan 2011 14:52:54 -0200

perf tools: Fix perf_event.h header usage

This patch fixes the usage of the perf_event.h header file between command modules and the supporting code in util.

It is necessary to ensure that ALL files use the SAME perf_event.h header from the kernel source tree.

There were a couple of #include <linux/perf_event.h> mixed with #include "../../perf_event.h".

This caused issues on some distros because of mismatch in the layout of struct perf_event_attr. That eventually led perf stat to segfault.

Cc: David S. Miller <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <[email protected]>

---
 tools/perf/util/evsel.h        |    2 +-
 tools/perf/util/parse-events.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/evsel.h +1 -1
index 863d78d..a0ccd69 100644
@@ -3,7 +3,7 @@
 
 #include <linux/list.h>
 #include <stdbool.h>
-#include <linux/perf_event.h>
+#include "../../../include/linux/perf_event.h"
 #include "types.h"
 #include "xyarray.h"
  
tools/perf/util/parse-events.h +1 -1
index 1c9043c..b82cafb 100644
@@ -4,7 +4,7 @@
  * Parse symbolic events/counts passed in as options:
  */
 
-#include <linux/perf_event.h>
+#include "../../../include/linux/perf_event.h"
 
 struct list_head;
 struct perf_evsel;