summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/oprofile/oprofile/0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/oprofile/oprofile/0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch')
-rw-r--r--meta/recipes-kernel/oprofile/oprofile/0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch132
1 files changed, 0 insertions, 132 deletions
diff --git a/meta/recipes-kernel/oprofile/oprofile/0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch b/meta/recipes-kernel/oprofile/oprofile/0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch
deleted file mode 100644
index 6f5b1c00ee..0000000000
--- a/meta/recipes-kernel/oprofile/oprofile/0001-Fix-PPC64-specific-libpfm-usage-so-it-doesn-t-break-.patch
+++ /dev/null
@@ -1,132 +0,0 @@
1Upstream-Status: Accepted
2
3From 8e36ad01ceb1257d05773b684dbe9358aecd3f71 Mon Sep 17 00:00:00 2001
4From: Maynard Johnson <maynardj@us.ibm.com>
5Date: Tue, 26 Feb 2013 13:41:27 -0600
6Subject: [PATCH] Fix PPC64-specific libpfm usage so it doesn't break ppc32
7 architecture
8
9The configure check to determine whether we should use libpfm or not
10is intended only for the ppc64 architecture, but was incorrectly
11hitting on the ppc32 architecture, too. Not only that, but it was using
12'uname' which is not a good idea in cross-compile situtations.
13
14Then, aside from that, we had several instances in the source code
15of the following:
16 #if (defined(__powerpc__) || defined(__powerpc64__))
17which incorrectly included ppc32 architecutre also, when it was intended
18for use as PPC64 architecture.
19
20This patch fixes both errors.
21
22Signed-off-by: Maynard Johnson <maynardj@us.ibm.com
23---
24 configure.ac | 5 ++---
25 libperf_events/operf_utils.cpp | 4 ++--
26 libperf_events/operf_utils.h | 6 ++++++
27 pe_profiling/operf.cpp | 10 +++++-----
28 4 files changed, 15 insertions(+), 10 deletions(-)
29
30diff --git a/configure.ac b/configure.ac
31index a9b1ee4..a0da98c 100644
32--- a/configure.ac
33+++ b/configure.ac
34@@ -154,11 +154,10 @@ else
35 fi
36
37 AC_DEFINE_UNQUOTED(HAVE_PERF_EVENTS, $HAVE_PERF_EVENTS, [Kernel support for perf_events exists])
38-
39+AC_CANONICAL_HOST
40 if test "$HAVE_PERF_EVENTS" = "1"; then
41 PFM_LIB=
42- arch="`uname -m`"
43- if test "$arch" = "ppc64" || test "$arch" = "ppc"; then
44+ if test "$host_cpu" = "powerpc64"; then
45 AC_CHECK_HEADER(perfmon/pfmlib.h,,[AC_MSG_ERROR([pfmlib.h not found; usually provided in papi devel package])])
46 AC_CHECK_LIB(pfm,pfm_get_os_event_encoding, HAVE_LIBPFM3='0'; HAVE_LIBPFM='1', [
47 AC_CHECK_LIB(pfm, pfm_get_event_name, HAVE_LIBPFM3='1'; HAVE_LIBPFM='1',
48diff --git a/libperf_events/operf_utils.cpp b/libperf_events/operf_utils.cpp
49index da964fd..a17200b 100644
50--- a/libperf_events/operf_utils.cpp
51+++ b/libperf_events/operf_utils.cpp
52@@ -83,7 +83,7 @@ static event_t comm_event;
53 * the following method is to map the operf-record event value to a value that
54 * opreport can understand.
55 */
56-#if (defined(__powerpc__) || defined(__powerpc64__))
57+#if PPC64_ARCH
58 #define NIL_CODE ~0U
59
60 #if HAVE_LIBPFM3
61@@ -716,7 +716,7 @@ static void __handle_sample_event(event_t * event, u64 sample_type)
62 } else if (event->header.misc == PERF_RECORD_MISC_USER) {
63 in_kernel = false;
64 }
65-#if (defined(__powerpc__) || defined(__powerpc64__))
66+#if PPC64_ARCH
67 else if (event->header.misc == PERF_RECORD_MISC_HYPERVISOR) {
68 #define MAX_HYPERVISOR_ADDRESS 0xfffffffULL
69 if (data.ip > MAX_HYPERVISOR_ADDRESS) {
70diff --git a/libperf_events/operf_utils.h b/libperf_events/operf_utils.h
71index 2df00b7..ddf05ed 100644
72--- a/libperf_events/operf_utils.h
73+++ b/libperf_events/operf_utils.h
74@@ -45,6 +45,12 @@ extern bool throttled;
75 #define MMAP_WINDOW_SZ (32 * 1024 * 1024ULL)
76 #endif
77
78+/* A macro to be used for ppc64 architecture-specific code. The '__powerpc__' macro
79+ * is defined for both ppc64 and ppc32 architectures, so we must further qualify by
80+ * including the 'HAVE_LIBPFM' macro, since that macro will be defined only for ppc64.
81+ */
82+#define PPC64_ARCH (HAVE_LIBPFM) && ((defined(__powerpc__) || defined(__powerpc64__)))
83+
84 extern unsigned int op_nr_counters;
85
86 static inline size_t align_64bit(u64 x)
87diff --git a/pe_profiling/operf.cpp b/pe_profiling/operf.cpp
88index e7c2eab..e1190c2 100644
89--- a/pe_profiling/operf.cpp
90+++ b/pe_profiling/operf.cpp
91@@ -1177,7 +1177,7 @@ static void _get_event_code(operf_event_t * event)
92 event->evt_code = config;
93 }
94
95-#if (defined(__powerpc__) || defined(__powerpc64__))
96+#if PPC64_ARCH
97 /* All ppc64 events (except CYCLES) have a _GRP<n> suffix. This is
98 * because the legacy opcontrol profiler can only profile events in
99 * the same group (i.e., having the same _GRP<n> suffix). But operf
100@@ -1287,7 +1287,7 @@ static void _process_events_list(void)
101 string full_cmd = cmd;
102 string event_spec = operf_options::evts[i];
103
104-#if (defined(__powerpc__) || defined(__powerpc64__))
105+#if PPC64_ARCH
106 event_spec = _handle_powerpc_event_spec(event_spec);
107 #endif
108
109@@ -1357,9 +1357,9 @@ static void _process_events_list(void)
110 _get_event_code(&event);
111 events.push_back(event);
112 }
113-#if (defined(__powerpc__) || defined(__powerpc64__))
114+#if PPC64_ARCH
115 {
116- /* This section of code is for architectures such as ppc[64] for which
117+ /* This section of code is soley for the ppc64 architecture for which
118 * the oprofile event code needs to be converted to the appropriate event
119 * code to pass to the perf_event_open syscall.
120 */
121@@ -1404,7 +1404,7 @@ static void get_default_event(void)
122 _get_event_code(&dft_evt);
123 events.push_back(dft_evt);
124
125-#if (defined(__powerpc__) || defined(__powerpc64__))
126+#if PPC64_ARCH
127 {
128 /* This section of code is for architectures such as ppc[64] for which
129 * the oprofile event code needs to be converted to the appropriate event
130--
1311.7.9.7
132